]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
libxfs: libxfs_buf_delwri_submit should write buffers immediately
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 1 Mar 2020 17:33:38 +0000 (12:33 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Sun, 1 Mar 2020 17:33:38 +0000 (12:33 -0500)
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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/rdwr.c
mkfs/xfs_mkfs.c

index e2d9d790452a65e35f406c602dbd271bc8f282dd..92281d586212d6e97c9c427e138bf3517142f66c 100644 (file)
@@ -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;
index d3b36756a37bc30aab2c39aa49c126266f45dccd..e303519a17ec78466e1dd72dc5f7b4a14b613692 100644 (file)
@@ -3640,6 +3640,7 @@ main(
        };
 
        struct list_head        buffer_list;
+       int                     error;
 
        platform_uuid_generate(&cli.uuid);
        progname = basename(argv[0]);
@@ -3840,16 +3841,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);
        }