Re: [PATCH v2] fs: always return zero on success from replace_fd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 05, 2025 at 01:55:59PM +0200, Christian Brauner wrote:

> The calling conventions of do_dup2() are terrible. The only reason it
> drops file_lock itself instead of leaving it to the two callers that
> have to acquire it anyway is because it wants to call filp_close() if
> there's already a file on that fd.

Alternative calling conventions end up being nastier - I've tried.

> And really the side-effect of dropping a lock implicitly is nasty
> especially when the function doesn't even indicate that it does that in
> it's name.
> 
> And guards are great.

They do no allow to express things like "foo() consumes lock X".

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux