From patchwork Wed Dec 13 21:49:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10110969 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 D0F5B602B3 for ; Wed, 13 Dec 2017 21:49:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C21A128FB8 for ; Wed, 13 Dec 2017 21:49:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B573A2910E; Wed, 13 Dec 2017 21:49:08 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 269D728FB8 for ; Wed, 13 Dec 2017 21:49:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753682AbdLMVtH (ORCPT ); Wed, 13 Dec 2017 16:49:07 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:28540 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753144AbdLMVtG (ORCPT ); Wed, 13 Dec 2017 16:49:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1513201746; x=1544737746; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=kglkKXVd2xNoHrp43qtsS+sFEOI9DcvvAqGG0p7jOeI=; b=KF6lRXnKyYR+8F4DW6hGuOvXO82Jf5pyLUcsSD2/LFZddYB+JAyvMclw frzWPkidl6vZWl7G6kTihytOYJqKLz90blCwsmAEhpqRKV3EHnB8UT24s wA1CezCyUEWv6H8PjPylGp13nEQHb+DjOiQu/qMjTdzIzk358zpwzwMXw FUgbRqibXvlluGHwz+VizhnCGFADdWiWrmPlPEHRHHyVIV6bU39Y08Psd QdhTI7ji6ErjVKCvgCkrYmHZthUaWdSKNSBFCJX45VCfPH7r78vjYI5+y kcXb90majRI3hDvciFUF32PX3nFpuIZSR0qBAz5JXWcjsNRgH5vTUPrkF Q==; X-IronPort-AV: E=Sophos;i="5.45,398,1508774400"; d="scan'208";a="65232298" Received: from mail-cys01nam02lp0056.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.56]) by ob1.hgst.iphmx.com with ESMTP; 14 Dec 2017 05:49:05 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kglkKXVd2xNoHrp43qtsS+sFEOI9DcvvAqGG0p7jOeI=; b=hmKtPG3WXyRxlpdRhNUkwrqVL4hGQ7J5jc97J0AZje6uJ1X6LGM6p0iIZyxRtjXSXCyJSYVu6J5V3q/NbKZh/8AtwyAuHuPxQ0ssxd4Su8qf+rsmL47g9K2uR/tbuW9vqAfisHVbN7aqSZAqZyaWW4qnaUPC26KNgx/hiLZCG0A= Received: from CY1PR0401MB1536.namprd04.prod.outlook.com (10.163.19.154) by CY1PR0401MB1533.namprd04.prod.outlook.com (10.163.19.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 13 Dec 2017 21:49:03 +0000 Received: from CY1PR0401MB1536.namprd04.prod.outlook.com ([10.163.19.154]) by CY1PR0401MB1536.namprd04.prod.outlook.com ([10.163.19.154]) with mapi id 15.20.0302.014; Wed, 13 Dec 2017 21:49:03 +0000 From: Bart Van Assche To: "mauricfo@linux.vnet.ibm.com" , "chenxiang66@hisilicon.com" , "hch@infradead.org" , "linux-block@vger.kernel.org" , "axboe@fb.com" , "ming.lei@redhat.com" CC: "osandov@fb.com" , "hare@suse.com" , "wenxiong@us.ibm.com" , "linuxarm@huawei.com" Subject: Re: [PATCH V2 0/2] block: fix queue freeze and cleanup Thread-Topic: [PATCH V2 0/2] block: fix queue freeze and cleanup Thread-Index: AQHTZBZKFJOUSQWQSUiZFkzU7UbAuaMoMgEAgAKBTQCAA/jCgIAACRoAgAAs6ICAEw4ggA== Date: Wed, 13 Dec 2017 21:49:03 +0000 Message-ID: <1513201741.2413.7.camel@wdc.com> References: <20171123044800.25251-1-ming.lei@redhat.com> <20171127124147.GA16095@ming.t460p> <1512144528.2520.2.camel@sandisk.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY1PR0401MB1533; 20:ASUbshmeFmIUFyOoPdQdcjMKStDB0t6x3FaBQOkp6REC+4DaNtrOqVM+w4Y/r1g8Cx2ozEETVf9NLqIH1smVGUm3kTREkqJK0L1y76FT/B2LHVk64BaarMkhAuyPR5QeNrIRE6gWwjwM6epbejkEjIk5GRAhbPe/IVRWwLSUzJ4= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 9f4ee266-1589-44a0-3381-08d5427353b2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307); SRVR:CY1PR0401MB1533; x-ms-traffictypediagnostic: CY1PR0401MB1533: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(3231023)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123564025)(20161123558100)(20161123555025)(6072148)(201708071742011); SRVR:CY1PR0401MB1533; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0401MB1533; x-forefront-prvs: 052017CAF1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(366004)(346002)(376002)(39860400002)(377424004)(199004)(189003)(24454002)(3846002)(76176011)(25786009)(2201001)(97736004)(86362001)(4326008)(6506007)(66066001)(305945005)(2501003)(8936002)(6116002)(53546011)(102836003)(575784001)(81156014)(81166006)(6436002)(8676002)(77096006)(7736002)(6486002)(5660300001)(2900100001)(2906002)(110136005)(3280700002)(54906003)(316002)(103116003)(478600001)(99286004)(2950100002)(6246003)(229853002)(7416002)(72206003)(68736007)(105586002)(93886005)(36756003)(3660700001)(6512007)(53936002)(106356001)(14454004)(8656006); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0401MB1533; H:CY1PR0401MB1536.namprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <4D423CDCB801644BA48984712618FF7F@namprd04.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f4ee266-1589-44a0-3381-08d5427353b2 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2017 21:49:03.3152 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB1533 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 On Fri, 2017-12-01 at 16:49 -0200, Mauricio Faria de Oliveira wrote: > LR [c00000000057c7fc] __blk_run_queue+0x6c/0xb0 > Call Trace: > [c0000001fb083970] [c0000001fb0839e0] 0xc0000001fb0839e0 (unreliable) > [c0000001fb0839a0] [c00000000057ce0c] blk_run_queue+0x4c/0x80 > [c0000001fb0839d0] [c000000000591f54] blk_freeze_queue_start+0xa4/0xb0 > [c0000001fb083a00] [c00000000057d5cc] blk_set_queue_dying+0x6c/0x190 > [c0000001fb083a30] [c0000000008a3fbc] __dm_destroy+0xac/0x300 > [c0000001fb083ad0] [c0000000008af6a4] dev_remove+0x154/0x1d0 > [c0000001fb083b20] [c0000000008affd0] ctl_ioctl+0x360/0x4f0 > [c0000001fb083d10] [c0000000008b0198] dm_ctl_ioctl+0x38/0x50 > [c0000001fb083d50] [c0000000003863b8] do_vfs_ioctl+0xd8/0x8c0 > [c0000001fb083df0] [c000000000386c08] SyS_ioctl+0x68/0x100 > [c0000001fb083e30] [c00000000000b760] system_call+0x58/0x6c > Instruction dump: > XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX > XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX > ---[ end trace e1710ec836e5526f ]--- > > Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b Hello Mauricio, Would it be possible to repeat your test with the patch below applied on your kernel tree? This patch has just been posted on the dm-devel mailing list. Thanks, Bart. From: Bart Van Assche Date: Wed, 13 Dec 2017 13:07:14 -0800 Subject: [PATCH] dm: Fix a recently introduced reference counting bug This patch avoids that the following message occurs sporadically in the system log (revealing that pgpath->path.dev->name became a dangling pointer): device-mapper: table: 254:2: device kkkkkkkkkkkkkkkkkkk?????????x0?a?????E??????????????E??????F?????2?????pF??????PF?????9[F??????]F???????#???????#??????'f????? not in table devices list This patch also fixes the following kernel crash: general protection fault: 0000 [#1] PREEMPT SMP RIP: 0010:multipath_busy+0x77/0xd0 [dm_multipath] Call Trace: dm_mq_queue_rq+0x44/0x110 [dm_mod] blk_mq_dispatch_rq_list+0x73/0x440 blk_mq_do_dispatch_sched+0x60/0xe0 blk_mq_sched_dispatch_requests+0x11a/0x1a0 __blk_mq_run_hw_queue+0x11f/0x1c0 __blk_mq_delay_run_hw_queue+0x95/0xe0 blk_mq_run_hw_queue+0x25/0x80 blk_mq_flush_plug_list+0x197/0x420 blk_flush_plug_list+0xe4/0x270 blk_finish_plug+0x27/0x40 __do_page_cache_readahead+0x2b4/0x370 force_page_cache_readahead+0xb4/0x110 generic_file_read_iter+0x755/0x970 __vfs_read+0xd2/0x140 vfs_read+0x9b/0x140 SyS_read+0x45/0xa0 do_syscall_64+0x56/0x1a0 entry_SYSCALL64_slow_path+0x25/0x25 From the disassembly of multipath_busy (0x77 = 119): ./include/linux/blkdev.h: 992 return bdev->bd_disk->queue; /* this is never NULL */ 0x00000000000006b4 <+116>: mov (%rax),%rax 0x00000000000006b7 <+119>: mov 0xe0(%rax),%rax Fixes: commit 2a0b4682e09d ("dm: convert dm_dev_internal.count from atomic_t to refcount_t") Signed-off-by: Bart Van Assche Cc: Elena Reshetova Cc: Kees Cook Cc: David Windsor Cc: Hans Liljestrand Cc: Hannes Reinecke Cc: stable@vger.kernel.org # v4.15 --- drivers/md/dm-table.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.15.1 diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 88130b5d95f9..ee5c389e7256 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -459,6 +459,8 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, if (r) return r; refcount_inc(&dd->count); + } else { + refcount_inc(&dd->count); } *result = dd->dm_dev;