[dm-devel] [PATCH] dm log: fix unitialized i/o operations flags
heinzm at redhat.com
heinzm at redhat.com
Tue Aug 23 19:17:48 UTC 2016
From: Heinz Mauelshagen <heinzm at redhat.com>
During the port to bio_set_op_attrs() of dm-io.c, a dm-log.c
caller was missing to initialize lc->io_req.bi_op_flags in the
rw_header() caller of dm_io() which lead to respective unitialized
bio->bi_op_flags in do_region().
Symptom was hitting the BUG() in sd_init_command() for SCSI devices.
Whilst on it, adjust rw_header() and its callers to use REQ_OP_{READ|WRITE}.
Signed-off-by: Heinz Mauelshagen <heinzm at redhat.com>
---
drivers/md/dm-log.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index 4ca2d1d..07fc1ad 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -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);
}
-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);
}
@@ -316,7 +317,7 @@ static int read_header(struct log_c *log)
{
int r;
- r = rw_header(log, READ);
+ r = rw_header(log, REQ_OP_READ);
if (r)
return r;
@@ -630,7 +631,7 @@ static int disk_resume(struct dm_dirty_log *log)
header_to_disk(&lc->header, lc->disk_header);
/* write the new header */
- r = rw_header(lc, WRITE);
+ r = rw_header(lc, REQ_OP_WRITE);
if (!r) {
r = flush_header(lc);
if (r)
@@ -698,7 +699,7 @@ static int disk_flush(struct dm_dirty_log *log)
log_clear_bit(lc, lc->clean_bits, i);
}
- r = rw_header(lc, WRITE);
+ r = rw_header(lc, REQ_OP_WRITE);
if (r)
fail_log_device(lc);
else {
--
2.7.4
More information about the dm-devel
mailing list