Re: [RFC PATCH 1/1] VFS: Augment /proc/mount with subroot and shared-subtree

Karel Zak
2007-06-26T08:01:32Z

On Mon, Jun 25, 2007 at 03:00:15PM -0700, Ram Pai wrote:
> Please check if the following modified patch meets the requirements.
>
> It augments /proc/mount with additional information to
> (1) disambiguate bind mounts with subroot information.
> (2) display shared-subtree information using which one can
> determine the propagation trees.
>
>
> The following additional fields are appended to each record
> in /proc/mounts

Can you append the new fields at real end of records? Now you have
the new fields between "options" and "freq, passno".

(BTW, maybe we can completely remove "freq, passno" from
/proc/mounts, especially if we don't have care about compatibility
with /etc/{mtab,fstab} format. The freq and passno are always zero in
/proc/mounts).

> mntid=id -> The unique id associated with that mount.
> fsid=id:dir -> The filesystem's id and directory in that filesystem
> that
> makes the root directory of this mount.
> parent=id -> The id of the mount's parent; on which it is mounted.

Do we really need a "<name>=" (mntid=, fsid=, parent=) prefixes? I
think your new fields are always in the same column (on same
position).

> also flags are augmented with new information to indicate the mount's
> propagation type.
>
> Here is a sample 'cat /proc/mounts' after executing the following
> commands:
> mount --bind /mnt /mnt
> mount --make-shared /mnt
> mount --bind /mnt/1 /var
> mount --make-slave /var
> mount --make-shared /mnt
> mount --make-unbindable /proc
>
> rootfs / rootfs rw PRIVATE mntid=c1708c30 fsid=1:/ parent=c1708c30 0 0
> /dev/root / ext2 rw PRIVATE mntid=c1208c08 fsid=6200:/ parent=c1708c30
> 0 0
> /proc /proc proc rw UNBINDABLE mntid=c1108c90 fsid=3:/ parent=c1208c08 0
> 0
> devpts /dev/pts devpts rw PRIVATE mntid=c1108c18 fsid=a:/
> parent=c1208c08 0 0
> /dev/root /mnt ext2 rw SHARED:peer=c1e08cb0 mntid=c1e08cb0
> fsid=6200:/mnt parent=c1208c08 0 0
> /dev/root /var ext2 rw SHARED:peer=c1f08c28 SLAVE:master=c1e08cb0
> mntid=c1f08c28 fsid=6200:/mnt/1 parent=c1208c08 0 0

You needn't "peer" or "master" keywords and it would be nice
to use one column for all propagation flags (separated by comma).

<FLAG>[:id>][,...]

for example:

SHARED:c1f08c28,SLAVE:c1e08cb0

Full example:

<fsname> <type> <opts> <freq> <passno> \
<propflags> <mntid> <fsid> <parentid>

rootfs / rootfs rw 0 0 PRIVATE c1708c30 1:/ c1708c30
/dev/root / ext2 rw 0 0 PRIVATE 1208c08 6200:/ c1708c30
/proc /proc proc rw 0 0 UNBINDABLE c1108c90 3:/ c1208c08
devpts /dev/pts devpts rw 0 0 PRIVATE c1108c18 a:/ c1208c08
/dev/root /mnt ext2 rw 0 0 SHARED:c1e08cb0 c1e08cb0 6200:/mnt c1208c08
/dev/root /var ext2 rw 0 0 SHARED:c1f08c28,SLAVE:c1e08cb0 c1f08c28 6200:/mnt/1 c1208c08

Karel

--
Karel Zak <kzak@redhat.com>