On Thu, 29 Jul 2021, J. Bruce Fields wrote: > On Wed, Jul 28, 2021 at 08:37:45AM +1000, NeilBrown wrote: > > @@ -232,6 +239,68 @@ reconnect_path(struct vfsmount *mnt, struct dentry *target_dir, char *nbuf) > > } > > dput(dentry); > > clear_disconnected(target_dir); > > Minor nit--I'd prefer the following in a separate function. Fair. Are you thinking "a separate function that is called here" or "a separate function that needs to be called by whoever called exportfs_decode_fh_raw()" if they happen to want the vfsmnt to be updated? NeilBrown > > --b. > > > + > > + /* Need to find appropriate vfsmount, which might not exist yet. > > + * We may need to trigger automount points. > > + */ > > + path.mnt = mnt; > > + path.dentry = target_dir; > > + vfs_getattr_nosec(&path, &stat, 0, AT_STATX_DONT_SYNC); > > + target_dev = stat.dev; > > + > > + path.dentry = mnt->mnt_root; > > + vfs_getattr_nosec(&path, &stat, 0, AT_STATX_DONT_SYNC); > > + > > + while (stat.dev != target_dev) { > > + /* walk up the dcache tree from target_dir, recording the > > + * location of the most recent change in dev number, > > + * until we find a mountpoint. > > + * If there was no change in show_dev result before the > > + * mountpount, the vfsmount at the mountpoint is what we want. > > + * If there was, we need to trigger an automount where the > > + * show_dev() result changed. > > + */