Christoph Hellwig writes:
> On Thu, Feb 22, 2001 at 11:48:07AM -0700, Andreas Dilger wrote:
> > I was looking at adding support to ext2 (and optionally other fses) to
> > allow it to set the "filesystem last mounted on" (s_last_mounted) field
> > in the on-disk ext2 superblock.  One reason for this is that AIX has such
> > a feature, and in conjunction with LVM it allows you to move a whole group
> > of disks from one system to another, and automatically build /etc/fstab
> > from on-disk data as the volume group is imported.
> 
> This is not possible (in a sane mannor) with Linux 2.4 as there is now limit
> on one mount per fs now (say: you can mount a partition twice).
> 
> And btw, people do even use it:  I for example have by build partition mounted
> once in the usual enviroment and once in a chroot()ed playground.

OK, for LVM it is enough to get the mount point on the first mount.  There
is only one field in the ext2 superblock anyways.  This still covers 99.9%
of usage, and in the end your fstab probably needs to hold the mountpoint
where the filesystem was mounted first.

Peter Braam writes:
> > The easiest way would be to simply pass dir_name down from do_mount to
> > get_sb_bdev to read_super, and change the fs read_super method to take
> > an extra parameter of dir_name.  However, this breaks all filesystems
> > and is not really an option for 2.2 or 2.4.  The other option is to
> > pass the dir_name in the super_block either as a new field at the end,
> > or by overloading one of the existing fields.  I thought of passing
> > the dentry for dir_name in sb->s_root (which gets overwritten by
> > d_alloc_root() when the fs is mounted), but we don't have enough info
> > to call __d_path() from within ext2_read_super() AFAIK, and this is
> > extra work given that we know the dir_name to start with.

> That's right, that dentry gets filled in only after read_super has
> finished.  InterMezzo uses the extra parameter approach. 

What I was suggesting is storing nd.dentry (which AFAICS holds the dentry
for dir_name in do_mount) into sb->s_root for use by the filesystem.
All filesystems will overwrite this field with their own root dentry
later, so it is pretty safe to overload in this way.  However __d_path()
in 2.4 needs a lot more parameters than d_path() did in 2.2, and I'm
guessing only Al Viro knows where to get them or how to fake it out.
Having the mount point dentry would be enough for 2.2 to get the mount
path.

> Passing the path to read super is not necessarily the right way to do it,
> since when file systems get mounted multiple times, read super is not
> called a second time (2.4 only).   This is pointing at a new method I
> think. 

I don't think the VFS calls into the filesystem at all (AFAICS) when it
is "bind" mounted, so there is no way to get parameters down anyways.
It calls get_sb_bdev(), but this just returns a pointer to the existing sb
from the mounted filesystem.  I don't think the filesystem itself should
(or does) care if it is mounted in several places, because the VFS handles
it for us.

Cheers, Andreas
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]

Reply via email to