From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752955AbbI3ArK (ORCPT ); Tue, 29 Sep 2015 20:47:10 -0400 Received: from mga14.intel.com ([192.55.52.115]:19183 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752782AbbI3ArI (ORCPT ); Tue, 29 Sep 2015 20:47:08 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,610,1437462000"; d="scan'208";a="815755007" Subject: [PATCH 0/2] block drivers + dax vs driver unbind From: Dan Williams To: axboe@kernel.dk Cc: Boaz Harrosh , linux-nvdimm@ml01.01.org, Dave Chinner , linux-kernel@vger.kernel.org, Keith Busch , ross.zwisler@linux.intel.com, Christoph Hellwig Date: Tue, 29 Sep 2015 20:41:25 -0400 Message-ID: <20150930002927.37133.331.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Auditing pmem driver teardown operations, while developing get_user_pages() support for dax [1], revealed that we can trivially crash the kernel by triggering new i/o requests after unbinding the pmem driver. In fact, any bio-based driver is susceptible to this crash because the queue draining done at shutdown uses in flight 'struct request' objects to pin the queue active. Solve the problem generically for all drivers and export the new blk_queue_enter() and blk_queue_exit() helpers for dax to indicate when the "request queue" is busy (i.e. we are actively using an address returned by ->direct_access()). [1]: https://lists.01.org/pipermail/linux-nvdimm/2015-September/002199.html --- Dan Williams (2): block: generic request_queue reference counting block, dax: fix lifetime of in-kernel dax mappings block/blk-core.c | 71 +++++++++++++++++++++++--- block/blk-mq-sysfs.c | 6 -- block/blk-mq.c | 80 +++++++++--------------------- block/blk-sysfs.c | 3 - block/blk.h | 12 ++++ fs/dax.c | 130 +++++++++++++++++++++++++++++++----------------- include/linux/blk-mq.h | 1 include/linux/blkdev.h | 4 + 8 files changed, 185 insertions(+), 122 deletions(-)