* [PATCH] dax: fix assertion in dax_iomap_rw()
@ 2025-10-02 8:13 Jan Kara
2025-10-02 9:56 ` Gao Xiang
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2025-10-02 8:13 UTC (permalink / raw)
To: Christian Brauner
Cc: Dan Williams, linux-fsdevel, Matthew Wilcox, chao, linux-erofs,
Jan Kara, syzbot+47680984f2d4969027ea
dax_iomap_rw() asserts that inode lock is held when reading from it. The
assert triggers on erofs as it indeed doesn't hold any locks in this
case - naturally because there's nothing to race against when the
filesystem is read-only. Check the locking only if the filesystem is
actually writeable.
Reported-by: syzbot+47680984f2d4969027ea@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/dax.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dax.c b/fs/dax.c
index 20ecf652c129..187f8c325744 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1752,7 +1752,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
if (iov_iter_rw(iter) == WRITE) {
lockdep_assert_held_write(&iomi.inode->i_rwsem);
iomi.flags |= IOMAP_WRITE;
- } else {
+ } else if (!IS_RDONLY(iomi.inode)) {
lockdep_assert_held(&iomi.inode->i_rwsem);
}
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] dax: fix assertion in dax_iomap_rw()
2025-10-02 8:13 [PATCH] dax: fix assertion in dax_iomap_rw() Jan Kara
@ 2025-10-02 9:56 ` Gao Xiang
0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2025-10-02 9:56 UTC (permalink / raw)
To: Jan Kara, Christian Brauner
Cc: Dan Williams, linux-fsdevel, Matthew Wilcox, chao, linux-erofs,
syzbot+47680984f2d4969027ea, Yuezhang Mo
Hi Jan,
On 2025/10/2 16:13, Jan Kara wrote:
> dax_iomap_rw() asserts that inode lock is held when reading from it. The
> assert triggers on erofs as it indeed doesn't hold any locks in this
> case - naturally because there's nothing to race against when the
> filesystem is read-only. Check the locking only if the filesystem is
> actually writeable.
>
> Reported-by: syzbot+47680984f2d4969027ea@syzkaller.appspotmail.com
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/dax.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 20ecf652c129..187f8c325744 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1752,7 +1752,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
> if (iov_iter_rw(iter) == WRITE) {
> lockdep_assert_held_write(&iomi.inode->i_rwsem);
> iomi.flags |= IOMAP_WRITE;
> - } else {
> + } else if (!IS_RDONLY(iomi.inode)) {
Thanks, Yuezheng also wrote a similiar patch
days ago (but it seems he didn't cc more related
people),
https://lore.kernel.org/r/20250930054256.2461984-2-Yuezhang.Mo@sony.com
both patches look good to me, thanks for the fix.
Thanks,
Gao Xiang
> lockdep_assert_held(&iomi.inode->i_rwsem);
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-02 9:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02 8:13 [PATCH] dax: fix assertion in dax_iomap_rw() Jan Kara
2025-10-02 9:56 ` Gao Xiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox