On Fri, 2007-12-14 at 16:14 +0100, Miklos Szeredi wrote: > > Neil suggested using device numbers which would work, however I think > > those might not be human friendly. While its easy to find the device > > number of a given path (eg.: stat -c %d /), its rather hard to find the > > path belonging to a given device number. > > Ram Pai had a patch which added the device number (among other things) > to /proc/mounts: > > > > Subject: [RFC2 PATCH 1/1] VFS: Augment /proc/mount with subroot and > shared-subtree > From: Ram Pai <[EMAIL PROTECTED]> > To: "H. Peter Anvin" <[EMAIL PROTECTED]> > Cc: Al Viro <[EMAIL PROTECTED]>, > Linux Kernel Mailing List <[email protected]>, > [EMAIL PROTECTED], [EMAIL PROTECTED] > In-Reply-To: <[EMAIL PROTECTED]> > Content-Type: text/plain > Date: Mon, 16 Jul 2007 11:46:48 -0700 > Content-Transfer-Encoding: 7bit > Sender: [EMAIL PROTECTED] > X-Mailing-List: [EMAIL PROTECTED] > > /proc/mounts in its current state fail to disambiguate bind mounts, > especially > when the bind mount is subrooted. Also it does not capture propagation state > of > the mounts(shared-subtree). The following patch addresses the problem. > > The following additional fields to /proc/mounts are added. > > propagation-type in the form of <propagation_flag>[:<mntid>][,...] > note: 'shared' flag is followed by the mntid of its peer mount > 'slave' flag is followed by the mntid of its master mount > 'private' flag stands by itself > 'unbindable' flag stands by itself > > mntid -- is a unique identifier of the mount > major:minor -- is the major minor number of the device hosting the filesystem > dir -- the subdir in the filesystem which forms the root of this mount > parent -- the id of the parent mount > > > Here is a sample cat /proc/mounts after execution the following commands: > > mount --bind /mnt /mnt > mount --make-shared /mnt > mount --bind /mnt/1 /var > mount --make-slave /var > mount --make-shared /var > mount --bind /var/abc /tmp > mount --make-unbindable /proc > > rootfs / rootfs rw 0 0 private 2 0:1 / 2 > /dev/root / ext2 rw 0 0 private 16 98:0 / 2 > /proc /proc proc rw 0 0 unbindable 17 0:3 / 16 > devpts /dev/pts devpts rw 0 0 private 18 0:10 / 16 > /dev/root /mnt ext2 rw 0 0 shared:19 19 98:0 /mnt 16 > /dev/root /var ext2 rw 0 0 shared:21,slave:19 20 98:0 /mnt/1 16 > /dev/root /tmp ext2 rw 0 0 shared:20,slave:19 21 98:0 /mnt/1/abc 16 > > For example, the last line indicates that : > > 1) The mount is a shared mount. > 2) Its peer mount of mount with id 20 > 3) It is also a slave mount of the master-mount with the id 19 > 4) The filesystem on device with major/minor number 98:0 and subdirectory > mnt/1/abc makes the root directory of this mount. > 5) And finally the mount with id 16 is its parent. > > > Testing: symlinked /etc/mtab to /proc/mounts and did some mount and df > commands. They worked normally. > > > > Signed-off-by: Ram Pai <[EMAIL PROTECTED]>
OK, I guess that would work. Ram Pai, what is the current status of that work? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

