From: Ram Pai <linuxram@us.ibm.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Andrew Morton <akpm@osdl.org>,
viro@parcelfarce.linux.theplanet.co.uk,
Avantika Mathur <mathurav@us.ibm.com>,
mike@waychison.com, janak@us.ibm.com,
linux-fsdevel@vger.kernel.org
Subject: mount behavior question.
Date: Thu, 28 Jul 2005 00:35:07 -0700 [thread overview]
Message-ID: <1122536107.4715.45.camel@localhost> (raw)
In-Reply-To: <1122500344.5037.171.camel@localhost>
Summary of the question:
Should the topmost mount be visible, or should the most recent
mount be visible?
consider the following command sequence
(1) cd /mnt
(2) mount --bind /usr /mnt
(3) mount --bind /bin /mnt
(4) mount --bind /var .
after step 1, the pwd of the process is pointing to root mount and
directory mnt. lets call the root mount as 'A'
after step 2, a new mount is laid on top of 'A' at the mountpoint mnt
lets call this mount 'B'
after step 3, a new mount is laid on top of 'B' at the mountpoint mnt
which corresponds to the root dentry of 'B'. lets call this new overlaid
mount as 'C'. At this point the visible content of /mnt is
the content of C.
however at step 4, a new mount is laid on top of 'A' at the same
mountpoint mnt, as that of 'B'. Lets call the new mount 'D'.
At this point, the visible content of /mnt is that of D and not that
of C
But should'nt it be C?
Why is that the contents of 'D' made visible? Is there any particular
reason for this behavior? Note: 'D' is mounted on the bottommost mount,
and hence should be obscured by the top level mounts.
To make it simpler, imagine you are viewing a 3 storied transparent
building from the top. If you place an apple in 1st floor and nothing is
placed on any other floors, the apple will be visible from the top.
Now if you place a 'orange' in the 2nd floor the apple should get
obscured by the orange and the 'orange' should start being visible. And
later if you place a 'mango' on 3rd floor, the mango should obscure both
the apple and orange. but at this point if you place another apple on
top of the first apple in the 1st floor, it cannot be visible, because
the 'orange' and the 'mango' block its line of sight. And hence the
'mango' should still continue to be visible. right? If the apple starts
becoming visible from the top, won't it defy law of visibility? :)
Back to the mount example:
Currently the behavior is the most recent mount is visible and not the
topmost mount.
Not many will run into this question currently, because the sequence of
steps have to orchestrated well to get into this scenario. But with
shared subtrees it is pretty easy to mount something at a lower level
mount because of propogations. And in this case the behavior becomes
totally confusing if the rule is 'expose the most-recent-mount and not
the topmost-mount'.
Here is a scenario with shared subtree. Sorry it is complex.
mount --bind /mnt /mnt
mount --make-shared /mnt
mkdir -p /mnt/p
mount --bind /usr /mnt/1
mount --bind /mnt /mnt/2
At this stage the mount at /mnt/2 and /mnt belong to the same pnode
which means mounts under them propogate to each other.
mount --bind /var /mnt/1
the contents of /var will be visible under /mnt/1 and not under /mnt/2
But if mount --bind /var /mnt/2 is executed, the contents of /var is
visible under /mnt/1 as well as /mnt/2 . Isn't this freaky?
On analysis it turns out the culprit is the current rule which says
'expose the most-recent-mount and not the topmost mount'
RP
next prev parent reply other threads:[~2005-07-28 7:35 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-25 22:44 (unknown) Ram Pai
2005-07-25 22:44 ` (unknown) Ram Pai
2005-07-25 22:44 ` (unknown) Ram Pai
2005-07-25 22:44 ` (unknown) Ram Pai
2005-07-25 22:44 ` (unknown) Ram Pai
2005-07-25 22:44 ` (unknown) Ram Pai
2005-07-25 22:44 ` (unknown) Ram Pai
2005-07-25 22:44 ` (unknown) Ram Pai
2005-07-26 2:53 ` supposed to be shared subtree patches Ram Pai
[not found] ` <20050725225908.031752000@localhost>
2005-07-27 19:13 ` [PATCH 3/7] shared subtree Miklos Szeredi
2005-07-27 20:30 ` Ram Pai
2005-07-28 8:34 ` Miklos Szeredi
[not found] ` <20050725225907.007405000@localhost>
2005-07-27 19:54 ` [PATCH 1/7] " Miklos Szeredi
2005-07-27 21:39 ` Ram Pai
2005-07-28 7:35 ` Ram Pai [this message]
2005-07-28 11:56 ` mount behavior question Miklos Szeredi
2005-07-28 15:02 ` Ram Pai
2005-07-28 15:58 ` Miklos Szeredi
2005-07-28 18:22 ` Ram Pai
2005-07-28 19:30 ` Miklos Szeredi
2005-07-28 20:09 ` Ram Pai
2005-07-28 20:44 ` Miklos Szeredi
2005-07-28 20:59 ` Ram Pai
2005-07-28 18:27 ` Bryan Henderson
2005-07-28 19:01 ` Miklos Szeredi
2005-07-28 20:35 ` Bryan Henderson
2005-07-28 20:42 ` Ram Pai
2005-07-28 22:27 ` Bryan Henderson
2005-07-28 22:59 ` Ram Pai
2005-07-28 20:53 ` Miklos Szeredi
2005-07-28 22:51 ` Bryan Henderson
2005-07-28 9:57 ` [PATCH 1/7] shared subtree Miklos Szeredi
2005-07-29 19:54 ` Ram Pai
2005-07-30 5:39 ` Miklos Szeredi
2005-07-31 0:45 ` Ram Pai
2005-07-31 7:52 ` Miklos Szeredi
2005-07-31 8:25 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1122536107.4715.45.camel@localhost \
--to=linuxram@us.ibm.com \
--cc=akpm@osdl.org \
--cc=janak@us.ibm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mathurav@us.ibm.com \
--cc=mike@waychison.com \
--cc=miklos@szeredi.hu \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox