linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs_io: report io error for pwrite -W and -w
@ 2017-10-12 20:49 Liu Bo
  2017-10-12 22:02 ` Darrick J. Wong
  2017-11-07 17:37 ` Eric Sandeen
  0 siblings, 2 replies; 4+ messages in thread
From: Liu Bo @ 2017-10-12 20:49 UTC (permalink / raw)
  To: linux-xfs

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>
---
 io/pwrite.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/io/pwrite.c b/io/pwrite.c
index 1c5dfca..71bcccc 100644
--- a/io/pwrite.c
+++ b/io/pwrite.c
@@ -379,11 +379,18 @@ pwrite_f(
 	}
 	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);
-- 
2.9.4

@@ -390,0 +397,0 @@

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-07 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-12 20:49 [PATCH] xfs_io: report io error for pwrite -W and -w Liu Bo
2017-10-12 22:02 ` Darrick J. Wong
2017-10-13 13:31   ` Brian Foster
2017-11-07 17:37 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).