[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b41b9b8e-6623-4e07-a132-515a6e88f1cc@linux.dev>
Date: Fri, 26 Sep 2025 12:22:37 +0800
From: Youling Tang <youling.tang@...ux.dev>
To: Kent Overstreet <kent.overstreet@...ux.dev>
Cc: linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org,
Youling Tang <tangyouling@...inos.cn>
Subject: Re: [PATCH 3/3] bcachefs: Move the link counting check to the VFS
layer
Hi, Kent
On 9/26/25 11:42, Kent Overstreet wrote:
> On Fri, Sep 26, 2025 at 10:21:50AM +0800, Youling Tang wrote:
>> From: Youling Tang <tangyouling@...inos.cn>
>>
>> Currently bcachefs only performs link count checks during link operations,
>> during rename and mkdir operations, the link count should also be checked.
>>
>> This patch moves the checks to the vfs_{link,rename,mkdir} functions when
>> sb->s_max_links is set, eliminating the need for filesystem-specific checks.
>>
>> Signed-off-by: Youling Tang <tangyouling@...inos.cn>
> I applied the other two patches, but not this one. We can't rely on the
> VFS for checks like this, there's lots of routes to modifying the
> filesystem that don't go through the VFS.
```
vfs_link
bch2_link
__bch2_link
bch2_link_trans
bch2_inode_nlink_inc
bch2_symlink
__bch2_link
```
I have traversed the bcachefs code and found that bch2_inode_nlink_inc is
called only once by bch2_link_trans, which in turn is called only once
by __bch2_link.
Although __bch2_link is also called by bch2_symlink, symlink operations
don't involve i_nlink values. Therefore, all effective calls to
bch2_inode_nlink_incoriginate from vfs_link. Please let me know if
there are any calls from other sources.
Even without moving to the VFS layer, do we still need to add link count
validation in bch2_{mkdir, rename}?
Thanks,
Youling.
Powered by blists - more mailing lists