When IO error occurs, xfs_io -c "pwrite -W/w" doesn't report errors
while xfs_io -c "pwrite" -c "fsync" does.
This changes "pwrite -W/w" to report errors when it should.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
}
if (c < 0)
goto done;
- if (Wflag)
- fsync(file->fd);
- if (wflag)
- fdatasync(file->fd);
+ if (Wflag) {
+ if (fsync(file->fd) < 0) {
+ perror("fsync");
+ goto done;
+ }
+ }
+ if (wflag) {
+ if (fdatasync(file->fd) < 0) {
+ perror("fdatasync");
+ goto done;
+ }
+ }
if (qflag)
goto done;
gettimeofday(&t2, NULL);