From patchwork Tue Aug 23 19:17:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinz Mauelshagen X-Patchwork-Id: 9296233 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B01F9607D0 for ; Tue, 23 Aug 2016 19:21:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3F9C212D8 for ; Tue, 23 Aug 2016 19:21:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 983ED28CDC; Tue, 23 Aug 2016 19:21:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 37522212D8 for ; Tue, 23 Aug 2016 19:21:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u7NJHrXg020540; Tue, 23 Aug 2016 15:17:54 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u7NJHqRj009712 for ; Tue, 23 Aug 2016 15:17:52 -0400 Received: from o.ww.redhat.com (ovpn-204-95.brq.redhat.com [10.40.204.95]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7NJHof9002903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 23 Aug 2016 15:17:52 -0400 Received: from o.ww.redhat.com (localhost.localdomain [127.0.0.1]) by o.ww.redhat.com (8.15.2/8.15.2) with ESMTP id u7NJHo2Z014261; Tue, 23 Aug 2016 21:17:50 +0200 Received: (from mauelsha@localhost) by o.ww.redhat.com (8.15.2/8.15.2/Submit) id u7NJHotV014260; Tue, 23 Aug 2016 21:17:50 +0200 From: heinzm@redhat.com To: dm-devel@redhat.com Date: Tue, 23 Aug 2016 21:17:48 +0200 Message-Id: <1471979868-14216-1-git-send-email-heinzm@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: dm-devel@redhat.com Cc: Heinz Mauelshagen Subject: [dm-devel] [PATCH] dm log: fix unitialized i/o operations flags X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP From: Heinz Mauelshagen 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 Reviewed-by: Shaun Tancheff --- 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 {