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: Mon, 24 Feb 2020 16:10:34 -0800	[thread overview]
Message-ID: <158258943449.451075.313299053272739325.stgit@magnolia> (raw)
In-Reply-To: <158258942838.451075.5401001111357771398.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 0d9d7202..2e9f66cc 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -1491,9 +1491,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 5a042917..1f5d2105 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-25  0:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25  0:10 [PATCH v3 0/7] xfsprogs: actually check that writes succeeded Darrick J. Wong
2020-02-25  0:10 ` Darrick J. Wong [this message]
2020-02-25  0:10 ` [PATCH 2/7] libxfs: complain when write IOs fail Darrick J. Wong
2020-02-25  0:10 ` [PATCH 3/7] libxfs: return flush failures Darrick J. Wong
2020-02-25  0:10 ` [PATCH 4/7] libxfs: flush all dirty buffers and report errors when unmounting filesystem Darrick J. Wong
2020-02-25 15:07   ` Brian Foster
2020-02-25 17:37   ` Christoph Hellwig
2020-02-25  0:10 ` [PATCH 5/7] mkfs: check that metadata updates have been committed Darrick J. Wong
2020-02-25 15:08   ` Brian Foster
2020-02-25 17:37   ` Christoph Hellwig
2020-02-25  0:11 ` [PATCH 6/7] xfs_repair: " Darrick J. Wong
2020-02-25 15:08   ` Brian Foster
2020-02-25 15:14     ` Darrick J. Wong
2020-02-25 17:38       ` Christoph Hellwig
2020-02-29 22:37         ` Eric Sandeen
2020-02-25 19:24   ` [PATCH v2 " Darrick J. Wong
2020-02-25  0:11 ` [PATCH 7/7] libfrog: always fsync when flushing a device Darrick J. Wong
2020-02-25 17:38   ` Christoph Hellwig
2020-02-28 23:35 [PATCH v4 0/7] xfsprogs: actually check that writes succeeded Darrick J. Wong
2020-02-28 23:35 ` [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=158258943449.451075.313299053272739325.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.