]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
block: submit_bh() inadvertently discards barrier flag on a sync write
authorJens Axboe <jens.axboe@oracle.com>
Wed, 3 Sep 2008 23:49:10 +0000 (19:49 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Oct 2008 03:22:55 +0000 (20:22 -0700)
commit 48fd4f93a00eac844678629f2f00518e146ed30d upstream

Reported by Milan Broz <mbroz@redhat.com>, commit 18ce3751 inadvertently
made submit_bh() discard the barrier bit for a WRITE_SYNC request. Fix
that up.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/buffer.c

index 0f51c0f7c266ee7ebf940d94f869081a4d80b084..42d2104170f8e7c2e87d90c5b6f9cc22bdecbb36 100644 (file)
@@ -2868,14 +2868,17 @@ int submit_bh(int rw, struct buffer_head * bh)
        BUG_ON(!buffer_mapped(bh));
        BUG_ON(!bh->b_end_io);
 
-       if (buffer_ordered(bh) && (rw == WRITE))
-               rw = WRITE_BARRIER;
+       /*
+        * Mask in barrier bit for a write (could be either a WRITE or a
+        * WRITE_SYNC
+        */
+       if (buffer_ordered(bh) && (rw & WRITE))
+               rw |= WRITE_BARRIER;
 
        /*
-        * Only clear out a write error when rewriting, should this
-        * include WRITE_SYNC as well?
+        * Only clear out a write error when rewriting
         */
-       if (test_set_buffer_req(bh) && (rw == WRITE || rw == WRITE_BARRIER))
+       if (test_set_buffer_req(bh) && (rw & WRITE))
                clear_buffer_write_io_error(bh);
 
        /*