summaryrefslogtreecommitdiffstats
path: root/fs/dax.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-02-08 20:43:13 +0100
committerTheodore Ts'o <tytso@mit.edu>2017-02-08 20:43:13 +0100
commit168316db3583253b9e5d46392e5b9d03d531406f (patch)
tree1d402c8b9dbc959dfc546a1cef16581b2b09a711 /fs/dax.c
parentext4: fix DAX write locking (diff)
downloadlinux-168316db3583253b9e5d46392e5b9d03d531406f.tar.xz
linux-168316db3583253b9e5d46392e5b9d03d531406f.zip
dax: assert that i_rwsem is held exclusive for writes
Make sure all callers follow the same locking protocol, given that DAX transparantly replaced the normal buffered I/O path. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/dax.c')
-rw-r--r--fs/dax.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 5c74f60d0a50..04734daed1bd 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1061,8 +1061,12 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
loff_t pos = iocb->ki_pos, ret = 0, done = 0;
unsigned flags = 0;
- if (iov_iter_rw(iter) == WRITE)
+ if (iov_iter_rw(iter) == WRITE) {
+ lockdep_assert_held_exclusive(&inode->i_rwsem);
flags |= IOMAP_WRITE;
+ } else {
+ lockdep_assert_held(&inode->i_rwsem);
+ }
while (iov_iter_count(iter)) {
ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops,