From patchwork Wed Jun 27 19:55:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10492567 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 0437060386 for ; Wed, 27 Jun 2018 19:55:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FA8129EDB for ; Wed, 27 Jun 2018 19:55:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01DCE29F06; Wed, 27 Jun 2018 19:55:20 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58C7529F15 for ; Wed, 27 Jun 2018 19:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966059AbeF0TzT (ORCPT ); Wed, 27 Jun 2018 15:55:19 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:15767 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965955AbeF0TzS (ORCPT ); Wed, 27 Jun 2018 15:55:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1530129820; x=1561665820; h=from:to:cc:subject:date:message-id; bh=lfVTEMEebfF3DnDd1/lIJX90wQgQlOvN4xyBsldzbYs=; b=oWXuX0SLb9xUUxDvFA5IUm+jrJ6D5ReE3QueU5ImrqdaTDMzUtjI0wKa KgsjJmND9ERaQ82XXsr8OLG6M+hUDoqdBvXOJG8FFem1pXRms6moSlUJa Qc9rosaDpd79VpEntlUfaLdHlEvTH0Ur1x/qN428szUSSDCOZKnsRMBhP a7wDa1tTViMdttSvbKFTRELQB1CbAqRfW3n9AlOXs1EGr1VlYN8rT7gD8 IPgHpCoujIfKJpFZwHpTkfgBWIPgDFMT1bqTX/i9eGyZAUG89uiFbIYgQ 9C3P7VwGTEEAlNubBw/j/4KpSXeow34suMdYS7iqStmo5B9SJDhKP4Qg5 Q==; X-IronPort-AV: E=Sophos;i="5.51,280,1526313600"; d="scan'208";a="179134907" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 28 Jun 2018 04:03:40 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 27 Jun 2018 12:44:50 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 27 Jun 2018 12:55:19 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Mike Snitzer , Ming Lei , Hannes Reinecke , Johannes Thumshirn , stable@vger.kernel.org Subject: [PATCH] block: Fix cloning of requests with a special payload Date: Wed, 27 Jun 2018 12:55:18 -0700 Message-Id: <20180627195518.13958-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.17.1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch avoids that removing a path controlled by the dm-mpath driver while mkfs is running triggers the following kernel bug: kernel BUG at block/blk-core.c:3347! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 20 PID: 24369 Comm: mkfs.ext4 Not tainted 4.18.0-rc1-dbg+ #2 RIP: 0010:blk_end_request_all+0x68/0x70 Call Trace: dm_softirq_done+0x326/0x3d0 [dm_mod] blk_done_softirq+0x19b/0x1e0 __do_softirq+0x128/0x60d irq_exit+0x100/0x110 smp_call_function_single_interrupt+0x90/0x330 call_function_single_interrupt+0xf/0x20 Fixes: f9d03f96b988 ("block: improve handling of the magic discard payload") Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Mike Snitzer Cc: Ming Lei Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Reviewed-by: Ming Lei Reviewed-by: Christoph Hellwig Acked-by: Mike Snitzer Reviewed-by: Sagi Grimberg --- block/blk-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 118dd17eb71f..f1e07ed1513c 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -3529,6 +3529,10 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src) dst->cpu = src->cpu; dst->__sector = blk_rq_pos(src); dst->__data_len = blk_rq_bytes(src); + if (src->rq_flags & RQF_SPECIAL_PAYLOAD) { + dst->rq_flags |= RQF_SPECIAL_PAYLOAD; + dst->special_vec = src->special_vec; + } dst->nr_phys_segments = src->nr_phys_segments; dst->ioprio = src->ioprio; dst->extra_len = src->extra_len;