From: Jan Kara <jack@suse.cz>
To: Christian Brauner <brauner@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>,
<linux-fsdevel@vger.kernel.org>,
Matthew Wilcox <willy@infradead.org>,
chao@kernel.org, linux-erofs@lists.ozlabs.org,
Jan Kara <jack@suse.cz>,
syzbot+47680984f2d4969027ea@syzkaller.appspotmail.com
Subject: [PATCH] dax: fix assertion in dax_iomap_rw()
Date: Thu, 2 Oct 2025 10:13:12 +0200 [thread overview]
Message-ID: <20251002081311.10488-2-jack@suse.cz> (raw)
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
next reply other threads:[~2025-10-02 8:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 8:13 Jan Kara [this message]
2025-10-02 9:56 ` [PATCH] dax: fix assertion in dax_iomap_rw() Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251002081311.10488-2-jack@suse.cz \
--to=jack@suse.cz \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=syzbot+47680984f2d4969027ea@syzkaller.appspotmail.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox