Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1176635

[PATCH v2 6/6] dax: bdev_direct_access() may sleep

From Matthew Wilcox <matthew.r.wilcox@intel.com>
Newsgroups linux.kernel
Subject [PATCH v2 6/6] dax: bdev_direct_access() may sleep
Date 2015-07-03 16:50 +0200
Message-ID <pIarU-1ha-25@gated-at.bofh.it> (permalink)
References <pIarT-1ha-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] Miscellaneous DAX patches, take 2 Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-07-03 16:50 +0200
  [PATCH v2 6/6] dax: bdev_direct_access() may sleep Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-07-03 16:50 +0200
  [PATCH v2 2/6] dax: Use copy_from_iter_nocache Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-07-03 16:50 +0200
  [PATCH v2 5/6] block: Add support for DAX reads/writes to block devices Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-07-03 16:50 +0200

csiph-web