Re: [PATCH 11/19] switch simple users of fdget() to CLASS(fd, ...)

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

 



On Fri, Jun 07, 2024 at 05:10:43PM +0100, Al Viro wrote:
> On Fri, Jun 07, 2024 at 05:26:53PM +0200, Christian Brauner wrote:
> > On Fri, Jun 07, 2024 at 02:59:49AM +0100, Al Viro wrote:
> > > low-hanging fruit; that's another likely source of conflicts
> > > over the cycle and it might make a lot of sense to split;
> > > fortunately, it can be split pretty much on per-function
> > > basis - chunks are independent from each other.
> > > 
> > > Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> > > ---
> > 
> > I can pick conversions from you for files where I already have changes
> > in the tree anyway or already have done conversion as part of other
> > patches.
> 
> Some notes:
> 
> 	This kind of conversions depends upon fdput(empty) being not just
> a no-op, but a no-op visible to compiler.  Representation change arranges
> for that.
> 
> 	CLASS(...) has some misfeatures or nearly C++ level of tastelessness;
> for this series I decided to try it and see how it goes, but... AFAICS in
> a lot of cases it's the wrong answer.
> 
> 	1.  Variable declarations belong in the beginning of block.
> CLASS use invites violating that; to make things worse, in-block goto
> bypassing such declaration is only caught by current clang.  Two
> examples got caught by Intel buildbot in this patch, actually - one
> in fs/select.c, another in ocfs2.

Considerably more than two, actually.  For example, this
        inode_lock(inode);
        /* Update mode */
        ovl_copyattr(inode);
        ret = file_remove_privs(file);
        if (ret)
                goto out_unlock;

        CLASS(fd_real, real)(file);
        if (fd_empty(real)) {
                ret = fd_error(real);
                goto out_unlock;
        }

        old_cred = ovl_override_creds(file_inode(file)->i_sb);
        ret = vfs_fallocate(fd_file(real), mode, offset, len);
        revert_creds(old_cred);

        /* Update size */
        ovl_file_modified(file);

out_unlock:
        inode_unlock(inode);

steps into the same problem.

Hell knows - it feels like mixing __cleanup-based stuff with anything
explicit leads to massive headache.  And I *really* hate to have
e.g. inode_unlock() hidden in __cleanup in a random subset of places.
Unlike dropping file references (if we do that a bit later, nothing
would really care), the loss of explicit control over the places where
inode lock is dropped is asking for serious trouble.

Any suggestions?  Linus, what's your opinion on the use of CLASS...
stuff?




[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