Re: [PATCH v1 02/12] Add and use d_for_each_positive_child family of iterators
Miklos Szeredi <[email protected]>
| Newsgroups | org.kernel.vger.ceph-devel,org.kernel.vger.autofs,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-nfs |
|---|---|
| Message-ID | <CAJfpegvTXG_kJHyFB115zdQvbyvDNtfqA_Mv9UKiEf9BE5qXwQ@mail.gmail.com> |
On Mon, 3 Aug 2026 at 03:38, NeilBrown <[email protected]> wrote: > coda_flag_children() doesn't need rcu_read_lock() as holding any > spinlock prevents an RCU critical section from finishing. I think prep changes should go in separate patches. The conversion should be an equivalent transformation. > nfs_clear_verifier_directory() is changed slightly so the parent lock is > dropped and retaken between clearing the verifier on the parent and on > all the children. I think this is safe. This can also be a prep patch. > get_next_postive_dentry() in autofs now holds the parent lock a bit > less. The only non-trivial code that is no locked any more is > parent = p->d_parent > This cannot need the lock as autofs doesn't support rename and > a ref is held on a descendent of parent, so ->d_parent cannot > change. And if it could, the lock wouldn't help. And this too. > diff --git a/fs/autofs/expire.c b/fs/autofs/expire.c > index 5c2d459e1e48..7b0a22629415 100644 > --- a/fs/autofs/expire.c > +++ b/fs/autofs/expire.c > @@ -70,12 +70,9 @@ static int autofs_mount_busy(struct vfsmount *mnt, > return status; > } > > -/* p->d_lock held */ > static struct dentry *positive_after(struct dentry *p, struct dentry *child) Move this primitive to libfs.c? > --- a/fs/ceph/mds_client.c > +++ b/fs/ceph/mds_client.c > @@ -2182,14 +2182,10 @@ static bool drop_negative_children(struct dentry *dentry) > if (!d_is_dir(dentry)) > goto out; > > - spin_lock(&dentry->d_lock); > - hlist_for_each_entry(child, &dentry->d_children, d_sib) { > - if (d_really_is_positive(child)) { > - all_negative = false; > - break; > - } > + d_for_each_positive_child(child, dentry) { > + all_negative = false; > + break; > } > - spin_unlock(&dentry->d_lock); simple_empty()? Thanks, Miklos