Re: [VFS] move active filesystem

Alexander Viro (viro@math.psu.edu)
Wed, 12 May 1999 14:13:03 -0400 (EDT)


On Wed, 12 May 1999, Matthew Wilcox wrote:
> On Wed, May 12, 1999 at 01:12:17PM -0400, Alexander Viro wrote:
> > Look at it that way: currently filesystems form a tree. Parent can be
> > found by ->s_root->d_covers->d_inode->i_sb. To prevent loops you need to
> > preserve tree structure. So yes, checking that we are not moving the fs
> > under itself is OK here - mounts are serialized wrt each other.
>
> provided we have suitable locking, yes I agree.

For mount() we have it - see mount_sem usage.

> > Another thing to consider: behaviour of NFS-exported filesystems. That has
> > nothing to loops. Look at the export table handling in knfsd. AFAICS it
> > may bite you if you are moving the stuff around that way.
> >
> > And another one: interaction with lookups. I have a nasty gut feeling that
> > in current form it has really unpleasant races waiting to happen as soon
> > as we'll allow to move mountpoints *not* dropping the whole tree under
> > them.
>
> Okay, you convinced me. Should the check go in the kernel or in mount(8)?

Why bother with mount(8)? Check is fairly trivial - you are taking a
dentry of new mountpoint anyway, so you can just do the following:

error = -EINVAL;
for(foo=mountpoint->d_inode->i_sb;
foo!=foo->s_root->d_covers->d_inode->i_sb;
foo=foo->s_root->d_covers->d_inode->i_sb)
if (foo == our_sb)
goto no_fscking_way;

That's it. Now, problems with knfsd remain - they have nothing to loops...
Could you look at it?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/