Commit 9c5a559d authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Mike Snitzer

dm log: fix unitialized bio operation flags

Commit e6047149 ("dm: use bio op accessors") switched DM over to
using bio_set_op_attrs() but didn't take care to initialize
lc->io_req.bi_op_flags in dm-log.c:rw_header().  This caused
rw_header()'s call to dm_io() to make bio->bi_op_flags be uninitialized
in dm-io.c:do_region(), which ultimately resulted in a SCSI BUG() in
sd_init_command().

Also, adjust rw_header() and its callers to use REQ_OP_{READ|WRITE}.

Fixes: e6047149 ("dm: use bio op accessors")
Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Reviewed-by: default avatarShaun Tancheff <shaun.tancheff@seagate.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 299f6230
...@@ -291,9 +291,10 @@ static void header_from_disk(struct log_header_core *core, struct log_header_dis ...@@ -291,9 +291,10 @@ static void header_from_disk(struct log_header_core *core, struct log_header_dis
core->nr_regions = le64_to_cpu(disk->nr_regions); core->nr_regions = le64_to_cpu(disk->nr_regions);
} }
static int rw_header(struct log_c *lc, int rw) static int rw_header(struct log_c *lc, int op)
{ {
lc->io_req.bi_op = rw; lc->io_req.bi_op = op;
lc->io_req.bi_op_flags = 0;
return dm_io(&lc->io_req, 1, &lc->header_location, NULL); return dm_io(&lc->io_req, 1, &lc->header_location, NULL);
} }
...@@ -316,7 +317,7 @@ static int read_header(struct log_c *log) ...@@ -316,7 +317,7 @@ static int read_header(struct log_c *log)
{ {
int r; int r;
r = rw_header(log, READ); r = rw_header(log, REQ_OP_READ);
if (r) if (r)
return r; return r;
...@@ -630,7 +631,7 @@ static int disk_resume(struct dm_dirty_log *log) ...@@ -630,7 +631,7 @@ static int disk_resume(struct dm_dirty_log *log)
header_to_disk(&lc->header, lc->disk_header); header_to_disk(&lc->header, lc->disk_header);
/* write the new header */ /* write the new header */
r = rw_header(lc, WRITE); r = rw_header(lc, REQ_OP_WRITE);
if (!r) { if (!r) {
r = flush_header(lc); r = flush_header(lc);
if (r) if (r)
...@@ -698,7 +699,7 @@ static int disk_flush(struct dm_dirty_log *log) ...@@ -698,7 +699,7 @@ static int disk_flush(struct dm_dirty_log *log)
log_clear_bit(lc, lc->clean_bits, i); log_clear_bit(lc, lc->clean_bits, i);
} }
r = rw_header(lc, WRITE); r = rw_header(lc, REQ_OP_WRITE);
if (r) if (r)
fail_log_device(lc); fail_log_device(lc);
else { else {
......
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