Commit 1fac74ef authored by Jens Axboe's avatar Jens Axboe Committed by Greg Kroah-Hartman

block: submit_bh() inadvertently discards barrier flag on a sync write

commit 48fd4f93 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: default avatarJens Axboe <jens.axboe@oracle.com>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b22d6750
...@@ -2868,14 +2868,17 @@ int submit_bh(int rw, struct buffer_head * bh) ...@@ -2868,14 +2868,17 @@ int submit_bh(int rw, struct buffer_head * bh)
BUG_ON(!buffer_mapped(bh)); BUG_ON(!buffer_mapped(bh));
BUG_ON(!bh->b_end_io); 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 * Only clear out a write error when rewriting
* include WRITE_SYNC as well?
*/ */
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); clear_buffer_write_io_error(bh);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment