All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org,
	Allison Collins <allison.henderson@oracle.com>,
	Christoph Hellwig <hch@lst.de>
Subject: [PATCH 1/7] libxfs: libxfs_buf_delwri_submit should write buffers immediately
Date: Fri, 28 Feb 2020 15:35:34 -0800	[thread overview]
Message-ID: <158293293395.1548526.4121108359275534784.stgit@magnolia> (raw)
In-Reply-To: <158293292760.1548526.16432706349096704475.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

The whole point of libxfs_buf_delwri_submit is to submit a bunch of
buffers for write and wait for the response.  Unfortunately, while it
does mark the buffers dirty, it doesn't actually flush them and lets the
cache mru flusher do it.  This is inconsistent with the kernel API,
which actually writes the buffers and returns any IO errors.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 libxfs/rdwr.c   |    3 ++-
 mkfs/xfs_mkfs.c |   16 ++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)


diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index e2d9d790..92281d58 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -1498,9 +1498,10 @@ xfs_buf_delwri_submit(
 
 	list_for_each_entry_safe(bp, n, buffer_list, b_list) {
 		list_del_init(&bp->b_list);
-		error2 = libxfs_writebuf(bp, 0);
+		error2 = libxfs_writebufr(bp);
 		if (!error)
 			error = error2;
+		libxfs_putbuf(bp);
 	}
 
 	return error;
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index c506577c..0f84860f 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -3685,6 +3685,7 @@ main(
 	};
 
 	struct list_head	buffer_list;
+	int			error;
 
 	platform_uuid_generate(&cli.uuid);
 	progname = basename(argv[0]);
@@ -3885,16 +3886,19 @@ main(
 		if (agno % 16)
 			continue;
 
-		if (libxfs_buf_delwri_submit(&buffer_list)) {
-			fprintf(stderr, _("%s: writing AG headers failed\n"),
-					progname);
+		error = -libxfs_buf_delwri_submit(&buffer_list);
+		if (error) {
+			fprintf(stderr,
+	_("%s: writing AG headers failed, err=%d\n"),
+					progname, error);
 			exit(1);
 		}
 	}
 
-	if (libxfs_buf_delwri_submit(&buffer_list)) {
-		fprintf(stderr, _("%s: writing AG headers failed\n"),
-				progname);
+	error = -libxfs_buf_delwri_submit(&buffer_list);
+	if (error) {
+		fprintf(stderr, _("%s: writing AG headers failed, err=%d\n"),
+				progname, error);
 		exit(1);
 	}
 


  reply	other threads:[~2020-02-28 23:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 23:35 [PATCH v4 0/7] xfsprogs: actually check that writes succeeded Darrick J. Wong
2020-02-28 23:35 ` Darrick J. Wong [this message]
2020-02-28 23:35 ` [PATCH 2/7] libxfs: complain when write IOs fail Darrick J. Wong
2020-02-28 23:35 ` [PATCH 3/7] libxfs: return flush failures Darrick J. Wong
2020-02-28 23:35 ` [PATCH 4/7] libxfs: flush all dirty buffers and report errors when unmounting filesystem Darrick J. Wong
2020-02-28 23:35 ` [PATCH 5/7] mkfs: check that metadata updates have been committed Darrick J. Wong
2020-02-28 23:36 ` [PATCH 6/7] xfs_repair: " Darrick J. Wong
2020-03-05 16:48   ` Christoph Hellwig
2020-02-28 23:36 ` [PATCH 7/7] libfrog: always fsync when flushing a device Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2020-02-25  0:10 [PATCH v3 0/7] xfsprogs: actually check that writes succeeded Darrick J. Wong
2020-02-25  0:10 ` [PATCH 1/7] libxfs: libxfs_buf_delwri_submit should write buffers immediately Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158293293395.1548526.4121108359275534784.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=allison.henderson@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.