Re: [PATCH 20/21] btrfs: Add inode->i_count instead of calling ihold()

Christoph Hellwig
2023-03-07T17:11:59Z

On Thu, Mar 02, 2023 at 04:25:05PM -0600, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
>
> I am not sure of this patch, but put it to avoid the WARN_ON() in
> ihold(). I am not sure why the i_count would drop below one at this
> point of time since this is still called within writepages context.
>
> Perhaps, there is a better way to solve this?

How do you trigger the warning? Basically i_count could only be
0 when doing writeback from inode evication, and just incrementing
i_count blindly will do the wrong thing there.