From: Christoph Hellwig <hch@lst.de>
To: Dan Carpenter <error27@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>, linux-xfs@vger.kernel.org
Subject: Re: [bug report] xfs: fix racy open zone caching
Date: Mon, 14 Sep 2026 13:59:44 +0200 [thread overview]
Message-ID: <20260914115944.GA23565@lst.de> (raw)
In-Reply-To: <aqfgjXJ8yANKjlwa@stanley.mountain>
On Mon, Sep 14, 2026 at 02:54:53PM +0300, Dan Carpenter wrote:
> fs/xfs/xfs_zone_alloc.c:823 xfs_get_cached_zone()
> error: we previously assumed 'oz' could be null (see line 813)
The warning is correct. I actually ran into it this weekend while
running benchmarks and sent a fix just a few minutes ago...
> 809 */
> 810 if (oz->oz_allocated == rtg_blocks(oz->oz_rtg)) {
> 811 spin_lock(&ip->i_flags_lock);
> 812 oz = VFS_I(ip)->i_private;
> 813 if (oz && oz->oz_allocated == rtg_blocks(oz->oz_rtg)) {
> ^^
> imagine oz is NULL
>
> 814 VFS_I(ip)->i_private = NULL;
> 815 spin_unlock(&ip->i_flags_lock);
> 816 xfs_open_zone_put(oz);
> 817 oz = NULL;
> 818 goto out_unlock;
> 819 }
> 820 spin_unlock(&ip->i_flags_lock);
> 821 }
> 822
> --> 823 if (!atomic_inc_not_zero(&oz->oz_ref))
> ^^
> then this will crash
>
> 824 oz = NULL;
> 825 out_unlock:
> 826 rcu_read_unlock();
> 827 return oz;
> 828 }
>
> This email is a free service from the Smatch-CI project [smatch.sf.net].
>
> regards,
> dan carpenter
---end quoted text---
prev parent reply other threads:[~2026-09-14 11:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 11:54 [bug report] xfs: fix racy open zone caching Dan Carpenter
2026-09-14 11:59 ` Christoph Hellwig [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=20260914115944.GA23565@lst.de \
--to=hch@lst.de \
--cc=error27@gmail.com \
--cc=linux-xfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.