Skip to content

Commit 43c3dd0

Browse files
Matthew WilcoxAl Viro
authored andcommitted
dax: bdev_direct_access() may sleep
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 <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent bbab37d commit 43c3dd0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/block_dev.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,12 @@ long bdev_direct_access(struct block_device *bdev, sector_t sector,
445445
long avail;
446446
const struct block_device_operations *ops = bdev->bd_disk->fops;
447447

448+
/*
449+
* The device driver is allowed to sleep, in order to make the
450+
* memory directly accessible.
451+
*/
452+
might_sleep();
453+
448454
if (size < 0)
449455
return size;
450456
if (!ops->direct_access)

0 commit comments

Comments
 (0)