Skip to content

Commit 154d1e7

Browse files
YuezhangMobrauner
authored andcommitted
dax: skip read lock assertion for read-only filesystems
The commit 168316d("dax: assert that i_rwsem is held exclusive for writes") added lock assertions to ensure proper locking in DAX operations. However, these assertions trigger false-positive lockdep warnings since read lock is unnecessary on read-only filesystems(e.g., erofs). This patch skips the read lock assertion for read-only filesystems, eliminating the spurious warnings while maintaining the integrity checks for writable filesystems. Fixes: 168316d ("dax: assert that i_rwsem is held exclusive for writes") Signed-off-by: Yuezhang Mo <[email protected]> Reviewed-by: Friendy Su <[email protected]> Reviewed-by: Daniel Palmer <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent d68a29a commit 154d1e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/dax.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
17251725
if (iov_iter_rw(iter) == WRITE) {
17261726
lockdep_assert_held_write(&iomi.inode->i_rwsem);
17271727
iomi.flags |= IOMAP_WRITE;
1728-
} else {
1728+
} else if (!sb_rdonly(iomi.inode->i_sb)) {
17291729
lockdep_assert_held(&iomi.inode->i_rwsem);
17301730
}
17311731

0 commit comments

Comments
 (0)