From patchwork Fri Jul 3 14:40:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wilcox, Matthew R" X-Patchwork-Id: 6716021 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B75A1C05AC for ; Fri, 3 Jul 2015 14:42:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 07D192065E for ; Fri, 3 Jul 2015 14:42:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2535720647 for ; Fri, 3 Jul 2015 14:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755325AbbGCOls (ORCPT ); Fri, 3 Jul 2015 10:41:48 -0400 Received: from mga11.intel.com ([192.55.52.93]:57062 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755373AbbGCOk6 (ORCPT ); Fri, 3 Jul 2015 10:40:58 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 03 Jul 2015 07:40:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,400,1432623600"; d="scan'208";a="518435778" Received: from rczak-mobl.amr.corp.intel.com (HELO thog.int.wil.cx) ([10.254.101.119]) by FMSMGA003.fm.intel.com with SMTP; 03 Jul 2015 07:40:57 -0700 Received: by thog.int.wil.cx (Postfix, from userid 1000) id 5272860ED9; Fri, 3 Jul 2015 10:40:56 -0400 (EDT) From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Viro Cc: Matthew Wilcox , willy@linux.intel.com Subject: [PATCH v2 6/6] dax: bdev_direct_access() may sleep Date: Fri, 3 Jul 2015 10:40:43 -0400 Message-Id: <1435934443-17090-7-git-send-email-matthew.r.wilcox@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435934443-17090-1-git-send-email-matthew.r.wilcox@intel.com> References: <1435934443-17090-1-git-send-email-matthew.r.wilcox@intel.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The brd driver is the only in-tree driver that may sleep currently. After some discussion on linux-fsdevel, we decided that any driver may choose to sleep in its ->direct_access method. To ensure that all callers of bdev_direct_access() are prepared for this, add a call to might_sleep(). Signed-off-by: Matthew Wilcox --- fs/block_dev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 0bb2993..1982437 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -446,6 +446,12 @@ long bdev_direct_access(struct block_device *bdev, sector_t sector, long avail; const struct block_device_operations *ops = bdev->bd_disk->fops; + /* + * The device driver is allowed to sleep, in order to make the + * memory directly accessible. + */ + might_sleep(); + if (size < 0) return size; if (!ops->direct_access)