Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752927AbdHVVot (ORCPT ); Tue, 22 Aug 2017 17:44:49 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:33530 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751909AbdHVVop (ORCPT ); Tue, 22 Aug 2017 17:44:45 -0400 X-IronPort-AV: E=Sophos;i="5.41,414,1498492800"; d="scan'208";a="44342215" From: Bart Van Assche To: "byungchul.park@lge.com" CC: "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "peterz@infradead.org" , "sergey.senozhatsky.work@gmail.com" , "martin.petersen@oracle.com" , "axboe@kernel.dk" , "linux-scsi@vger.kernel.org" , "sfr@canb.auug.org.au" , "linux-next@vger.kernel.org" Subject: Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Thread-Topic: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Thread-Index: AQHTGzQfHluq9mlb7kKn+V4VO2ZCc6KQ6RcA Date: Tue, 22 Aug 2017 21:43:56 +0000 Message-ID: <1503438234.2508.27.camel@wdc.com> References: <20170822183816.7925e0f8@canb.auug.org.au> <20170822104708.GA491@jagdpanzerIV.localdomain> In-Reply-To: <20170822104708.GA491@jagdpanzerIV.localdomain> 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: [63.163.107.100] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY1PR0401MB1003;20:l3L1kVN2fFg76TK6Ptqx+ELX+iEfBX3qX62Wmtkb6CRiNDzSEhlHBsi8e1B4IiibeUpYMp+AQiZIHYuTFDg7Knx2CnWJkKxoQNrXmhaCqd6ayaTIxuIE21bltUdwA32xqd8ngjfeE28mRovxEF8pDTU4baCtbvkd2eS8ghnH2l8= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: f9948910-2918-41bd-d275-08d4e9a6e3f4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603174)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY1PR0401MB1003; x-ms-traffictypediagnostic: CY1PR0401MB1003: wdcipoutbound: EOP-TRUE x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR0401MB1003;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR0401MB1003; x-forefront-prvs: 04073E895A x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(24454002)(189002)(377424004)(199003)(4326008)(53936002)(25786009)(99286003)(36756003)(5640700003)(54906002)(2501003)(8936002)(6436002)(66066001)(68736007)(14454004)(6512007)(478600001)(33646002)(81166006)(105586002)(2351001)(81156014)(7416002)(305945005)(103116003)(2950100002)(102836003)(3846002)(97736004)(101416001)(6116002)(189998001)(7736002)(2906002)(50986999)(3660700001)(229853002)(3280700002)(86362001)(6916009)(2900100001)(72206003)(6246003)(8676002)(6486002)(54356999)(5660300001)(39060400002)(110136004)(106356001)(6506006)(77096006)(76176999);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0401MB1003;H:CY1PR0401MB1536.namprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Aug 2017 21:43:56.3616 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB1003 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v7MLisAC020745 Content-Length: 3676 Lines: 96 On Tue, 2017-08-22 at 19:47 +0900, Sergey Senozhatsky wrote: > ====================================================== > WARNING: possible circular locking dependency detected > 4.13.0-rc6-next-20170822-dbg-00020-g39758ed8aae0-dirty #1746 Not tainted > ------------------------------------------------------ > fsck.ext4/148 is trying to acquire lock: > (&bdev->bd_mutex){+.+.}, at: [] __blkdev_put+0x33/0x190 > > but now in release context of a crosslock acquired at the following: > ((complete)&wait#2){+.+.}, at: [] blk_execute_rq+0xbb/0xda > > which lock already depends on the new lock. > > the existing dependency chain (in reverse order) is: > > -> #1 ((complete)&wait#2){+.+.}: > lock_acquire+0x176/0x19e > __wait_for_common+0x50/0x1e3 > blk_execute_rq+0xbb/0xda > scsi_execute+0xc3/0x17d [scsi_mod] > sd_revalidate_disk+0x112/0x1549 [sd_mod] > rescan_partitions+0x48/0x2c4 > __blkdev_get+0x14b/0x37c > blkdev_get+0x191/0x2c0 > device_add_disk+0x2b4/0x3e5 > sd_probe_async+0xf8/0x17e [sd_mod] > async_run_entry_fn+0x34/0xe0 > process_one_work+0x2af/0x4d1 > worker_thread+0x19a/0x24f > kthread+0x133/0x13b > ret_from_fork+0x27/0x40 > > -> #0 (&bdev->bd_mutex){+.+.}: > __blkdev_put+0x33/0x190 > blkdev_close+0x24/0x27 > __fput+0xee/0x18a > task_work_run+0x79/0xa0 > prepare_exit_to_usermode+0x9b/0xb5 > > other info that might help us debug this: > Possible unsafe locking scenario by crosslock: > CPU0 CPU1 > ---- ---- > lock(&bdev->bd_mutex); > lock((complete)&wait#2); > lock(&bdev->bd_mutex); > unlock((complete)&wait#2); > > *** DEADLOCK *** > 4 locks held by fsck.ext4/148: > #0: (&bdev->bd_mutex){+.+.}, at: [] __blkdev_put+0x33/0x190 > #1: (rcu_read_lock){....}, at: [] rcu_lock_acquire+0x0/0x20 > #2: (&(&host->lock)->rlock){-.-.}, at: [] ata_scsi_queuecmd+0x23/0x74 [libata] > #3: (&x->wait#14){-...}, at: [] complete+0x18/0x50 > > stack backtrace: > CPU: 1 PID: 148 Comm: fsck.ext4 Not tainted 4.13.0-rc6-next-20170822-dbg-00020-g39758ed8aae0-dirty #1746 > Call Trace: > dump_stack+0x67/0x8e > print_circular_bug+0x2a1/0x2af > ? zap_class+0xc5/0xc5 > check_prev_add+0x76/0x20d > ? __lock_acquire+0xc27/0xcc8 > lock_commit_crosslock+0x327/0x35e > complete+0x24/0x50 > scsi_end_request+0x8d/0x176 [scsi_mod] > scsi_io_completion+0x1be/0x423 [scsi_mod] > __blk_mq_complete_request+0x112/0x131 > ata_scsi_simulate+0x212/0x218 [libata] > __ata_scsi_queuecmd+0x1be/0x1de [libata] > ata_scsi_queuecmd+0x41/0x74 [libata] > scsi_dispatch_cmd+0x194/0x2af [scsi_mod] > scsi_queue_rq+0x1e0/0x26f [scsi_mod] > blk_mq_dispatch_rq_list+0x193/0x2a7 > ? _raw_spin_unlock+0x2e/0x40 > blk_mq_sched_dispatch_requests+0x132/0x176 > __blk_mq_run_hw_queue+0x59/0xc5 > __blk_mq_delay_run_hw_queue+0x5f/0xc1 > blk_mq_flush_plug_list+0xfc/0x10b > blk_flush_plug_list+0xc6/0x1eb > blk_finish_plug+0x25/0x32 > generic_writepages+0x56/0x63 > do_writepages+0x36/0x70 > __filemap_fdatawrite_range+0x59/0x5f > filemap_write_and_wait+0x19/0x4f > __blkdev_put+0x5f/0x190 > blkdev_close+0x24/0x27 > __fput+0xee/0x18a > task_work_run+0x79/0xa0 > prepare_exit_to_usermode+0x9b/0xb5 > entry_SYSCALL_64_fastpath+0xab/0xad Byungchul, did you add the crosslock checks to lockdep? Can you have a look at the above report? That report namely doesn't make sense to me. Bart.