1 dax: assert that i_rwsem is held exclusive for writes
3 From: Christoph Hellwig <hch@lst.de>
5 Make sure all callers follow the same locking protocol, given that DAX
6 transparantly replaced the normal buffered I/O path.
8 Signed-off-by: Christoph Hellwig <hch@lst.de>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 Reviewed-by: Jan Kara <jack@suse.cz>
13 1 file changed, 5 insertions(+), 1 deletion(-)
15 diff --git a/fs/dax.c b/fs/dax.c
16 index 5c74f60d0a50..04734daed1bd 100644
19 @@ -1061,8 +1061,12 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
20 loff_t pos = iocb->ki_pos, ret = 0, done = 0;
23 - if (iov_iter_rw(iter) == WRITE)
24 + if (iov_iter_rw(iter) == WRITE) {
25 + lockdep_assert_held_exclusive(&inode->i_rwsem);
28 + lockdep_assert_held(&inode->i_rwsem);
31 while (iov_iter_count(iter)) {
32 ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops,