From: Al Viro <viro@ZenIV.linux.org.uk>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>, linux-fsdevel@vger.kernel.org
Subject: Re: path-lookup inconsistency ?
Date: Fri, 20 May 2016 06:26:39 +0100 [thread overview]
Message-ID: <20160520052639.GT14480@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAPTae5+0v_Bec_=53Abuzxfq4raNZCt8eJHYMNeF=Pdbu===yA@mail.gmail.com>
On Thu, May 19, 2016 at 07:20:26PM -0700, Badhri Jagan Sridharan wrote:
> Hi,
>
> I mounted overlayfs at /
>
> My cat /proc/mounts looks like the following.
> # cat /proc/mounts
> /dev/root / squashfs ro,seclabel,relatime 0 0
> ..
> overlayfs / overlay
> rw,relatime,lowerdir=/,upperdir=/cache/upper,workdir=/cache/working 0
> 0
>
> The original blockdevice at fs root is squashfs formatted so doesnt
> support write operations. I mounted overlayfs on fs root to cache the
> writes made.
>
> While in /, the filesystem does not allow me to create files/directories,
> if I dont prefix it with ".." directive.
Chroot to the thing that overmounts root. All that .. is doing here is
triggering the traversal to whatever covers the parent (== whatever
covers the root itself, since the parent of root is the root itself).
And we do *not* cross a mountpoint if the starting point of lookup
happens to be covered. Might've been better if we did a different semantics,
but this one is userland-exposed and, worse yet, a bunch of early boot
userland code relies upon it.
What you want is to be chrooted to whatever overmounts the global root.
The easiest way is probably chroot("/..");chdir("/"); when you are
setting the things up. Before you exec the final /sbin/init...
prev parent reply other threads:[~2016-05-20 5:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-20 2:20 path-lookup inconsistency ? Badhri Jagan Sridharan
2016-05-20 5:26 ` Al Viro [this message]
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=20160520052639.GT14480@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=badhri@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).