All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew.r.wilcox@intel.com>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>, willy@linux.intel.com
Subject: [PATCH v2 6/6] dax: bdev_direct_access() may sleep
Date: Fri,  3 Jul 2015 10:40:43 -0400	[thread overview]
Message-ID: <1435934443-17090-7-git-send-email-matthew.r.wilcox@intel.com> (raw)
In-Reply-To: <1435934443-17090-1-git-send-email-matthew.r.wilcox@intel.com>

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 <matthew.r.wilcox@intel.com>
---
 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)
-- 
2.1.4


      parent reply	other threads:[~2015-07-03 14:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 14:40 [PATCH v2 0/6] Miscellaneous DAX patches, take 2 Matthew Wilcox
2015-07-03 14:40 ` [PATCH v2 1/6] dax: Add block size note to documentation Matthew Wilcox
2015-07-04  5:03   ` Christoph Hellwig
2015-07-05  8:43     ` Boaz Harrosh
2015-07-03 14:40 ` [PATCH v2 2/6] dax: Use copy_from_iter_nocache Matthew Wilcox
2015-07-05 13:11   ` Boaz Harrosh
2015-07-03 14:40 ` [PATCH v2 3/6] ext4: Use ext4_get_block_write() for DAX Matthew Wilcox
2015-07-03 18:30   ` Theodore Ts'o
2015-07-03 18:48     ` Matthew Wilcox
2015-07-03 19:07       ` Theodore Ts'o
2015-07-05 13:29         ` Boaz Harrosh
2015-07-03 14:40 ` [PATCH v2 4/6] vfs: Allow truncate, chomd and chown to be interrupted by fatal signals Matthew Wilcox
2015-07-03 14:40 ` [PATCH v2 5/6] block: Add support for DAX reads/writes to block devices Matthew Wilcox
2015-07-05 13:47   ` Boaz Harrosh
2015-07-03 14:40 ` Matthew Wilcox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435934443-17090-7-git-send-email-matthew.r.wilcox@intel.com \
    --to=matthew.r.wilcox@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.