Re: [PATCH v3 02/21] coda_flag_children(): cope with dentries turning negative

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

 



On Thu, 23 Nov 2023 at 22:04, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> ->d_lock on parent does not stabilize ->d_inode of child.
> We don't do much with that inode in there, but we need
> at least to avoid struct inode getting freed under us...

Gaah. We've gone back and forth on this. Being non-preemptible is
already equivalent to rcu read locking.

>From Documentation/RCU/rcu_dereference.rst:

                            With the new consolidated
        RCU flavors, an RCU read-side critical section is entered
        using rcu_read_lock(), anything that disables bottom halves,
        anything that disables interrupts, or anything that disables
        preemption.

so I actually think the coda code is already mostly fine, because that
parent spin_lock may not stabilize d_child per se, but it *does* imply
a RCU read lock.

So I think you should drop the rcu_read_lock/rcu_read_unlock from that patch.

But that

                struct inode *inode = d_inode_rcu(de);

conversion is required to get a stable inode pointer.

So half of this patch is unnecessary.

Adding Paul to the cc just to verify that the docs are up-to-date and
that we're still good here.

Because we've gone back-and-forth on the "spinlocks are an implied RCU
read-side critical section" a couple of times.

                  Linus




[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