Linux filesystem development
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Jan Kara <jack@suse.cz>, 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,
	syzbot+47680984f2d4969027ea@syzkaller.appspotmail.com,
	Yuezhang Mo <yuezhang.mo@sony.com>
Subject: Re: [PATCH] dax: fix assertion in dax_iomap_rw()
Date: Thu, 2 Oct 2025 17:56:37 +0800	[thread overview]
Message-ID: <68b155c5-65b2-4b03-a8a3-69dffc41dd1c@linux.alibaba.com> (raw)
In-Reply-To: <20251002081311.10488-2-jack@suse.cz>

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);
>   	}
>   


      reply	other threads:[~2025-10-02  9:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02  8:13 [PATCH] dax: fix assertion in dax_iomap_rw() Jan Kara
2025-10-02  9:56 ` Gao Xiang [this message]

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=68b155c5-65b2-4b03-a8a3-69dffc41dd1c@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=brauner@kernel.org \
    --cc=chao@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=jack@suse.cz \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=syzbot+47680984f2d4969027ea@syzkaller.appspotmail.com \
    --cc=willy@infradead.org \
    --cc=yuezhang.mo@sony.com \
    /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