diff mbox series

[15/15] iomap: Reinstate lockdep_assert_held in iomap_dio_rw()

Message ID 20200921144353.31319-16-rgoldwyn@suse.de (mailing list archive)
State New, archived
Headers show
Series BTRFS DIO inode locking/D_SYNC fix | expand

Commit Message

Goldwyn Rodrigues Sept. 21, 2020, 2:43 p.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

btrfs holds inode_lock_shared() while performing DIO within EOF, so
lockdep_assert_held() check can be re-instated.

Revert 3ad99bec6e82 ("iomap: remove lockdep_assert_held()")

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/iomap/direct-io.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Christoph Hellwig Sept. 22, 2020, 1:26 p.m. UTC | #1
On Mon, Sep 21, 2020 at 09:43:53AM -0500, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> 
> btrfs holds inode_lock_shared() while performing DIO within EOF, so
> lockdep_assert_held() check can be re-instated.
> 
> Revert 3ad99bec6e82 ("iomap: remove lockdep_assert_held()")

It turns out gfs2 also calls without the lock, so while I'd love to see
the assert come back we'd regress gfs2.
diff mbox series

Patch

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index e01f81e7b76f..b5e030971001 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -421,6 +421,8 @@  __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
 	struct blk_plug plug;
 	struct iomap_dio *dio;
 
+	lockdep_assert_held(&inode->i_rwsem);
+
 	if (!count)
 		return NULL;