summaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-04 22:36:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-04 22:36:06 -0400
commit1dc51b8288007753ad7cd7d08bb8fa930fc8bb10 (patch)
tree0616c0ff7d877e64d9c248a6cdff074eae258840 /fs/block_dev.c
parent9b284cbdb5de3b8871014f8290d1b540e5181c21 (diff)
parent0f1db7dee200127da4c07928189748918c312031 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro: "Assorted VFS fixes and related cleanups (IMO the most interesting in that part are f_path-related things and Eric's descriptor-related stuff). UFS regression fixes (it got broken last cycle). 9P fixes. fs-cache series, DAX patches, Jan's file_remove_suid() work" [ I'd say this is much more than "fixes and related cleanups". The file_table locking rule change by Eric Dumazet is a rather big and fundamental update even if the patch isn't huge. - Linus ] * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (49 commits) 9p: cope with bogus responses from server in p9_client_{read,write} p9_client_write(): avoid double p9_free_req() 9p: forgetting to cancel request on interrupted zero-copy RPC dax: bdev_direct_access() may sleep block: Add support for DAX reads/writes to block devices dax: Use copy_from_iter_nocache dax: Add block size note to documentation fs/file.c: __fget() and dup2() atomicity rules fs/file.c: don't acquire files->file_lock in fd_install() fs:super:get_anon_bdev: fix race condition could cause dev exceed its upper limitation vfs: avoid creation of inode number 0 in get_next_ino namei: make set_root_rcu() return void make simple_positive() public ufs: use dir_pages instead of ufs_dir_pages() pagemap.h: move dir_pages() over there remove the pointless include of lglock.h fs: cleanup slight list_entry abuse xfs: Correctly lock inode when removing suid and file capabilities fs: Call security_ops->inode_killpriv on truncate fs: Provide function telling whether file_remove_privs() will do anything ...
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 4fe10f93db8a..198243717da5 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -152,6 +152,9 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
152 struct file *file = iocb->ki_filp; 152 struct file *file = iocb->ki_filp;
153 struct inode *inode = file->f_mapping->host; 153 struct inode *inode = file->f_mapping->host;
154 154
155 if (IS_DAX(inode))
156 return dax_do_io(iocb, inode, iter, offset, blkdev_get_block,
157 NULL, DIO_SKIP_DIO_COUNT);
155 return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset, 158 return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset,
156 blkdev_get_block, NULL, NULL, 159 blkdev_get_block, NULL, NULL,
157 DIO_SKIP_DIO_COUNT); 160 DIO_SKIP_DIO_COUNT);
@@ -443,6 +446,12 @@ long bdev_direct_access(struct block_device *bdev, sector_t sector,
443 long avail; 446 long avail;
444 const struct block_device_operations *ops = bdev->bd_disk->fops; 447 const struct block_device_operations *ops = bdev->bd_disk->fops;
445 448
449 /*
450 * The device driver is allowed to sleep, in order to make the
451 * memory directly accessible.
452 */
453 might_sleep();
454
446 if (size < 0) 455 if (size < 0)
447 return size; 456 return size;
448 if (!ops->direct_access) 457 if (!ops->direct_access)
@@ -1170,6 +1179,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1170 bdev->bd_disk = disk; 1179 bdev->bd_disk = disk;
1171 bdev->bd_queue = disk->queue; 1180 bdev->bd_queue = disk->queue;
1172 bdev->bd_contains = bdev; 1181 bdev->bd_contains = bdev;
1182 bdev->bd_inode->i_flags = disk->fops->direct_access ? S_DAX : 0;
1173 if (!partno) { 1183 if (!partno) {
1174 ret = -ENXIO; 1184 ret = -ENXIO;
1175 bdev->bd_part = disk_get_part(disk, partno); 1185 bdev->bd_part = disk_get_part(disk, partno);