From: Jan Kara <jack@suse.cz>
To: Joerg Schilling <schily@schily.net>
Cc: otnaccess@hotmail.com, jack@suse.cz,
linux-fsdevel@vger.kernel.org, joerg@schily.net
Subject: Re: FW: Symbolic link with absolute target path in UDF - not working properly?
Date: Tue, 13 Dec 2011 17:13:03 +0100 [thread overview]
Message-ID: <20111213161303.GE11747@quack.suse.cz> (raw)
In-Reply-To: <4ee73093.ByQYnWpgRk/yNHIS%schily@schily.net>
On Tue 13-12-11 12:01:39, Joerg Schilling wrote:
> And BTW: given the fact that Linux supports programs like "df", I would guess
> that it is possible to do that mapping. Note that unless you do something
> really weird (which would be in conflict with the POSIX standard), you always
> know the vfs structure for a file and a vfs structure of course has an
> associated mount point. Given the fact that in an FS that does not support
> hard links to directories (UDF does not, so you are on the easy side) there is
> exactly one way to traverse the directory tree upwards, As a result, there is
> always exactly one mountpoint related to any leaf fs object.
>
> AFAIK, Linux does getcwd() in kernel as Solaris does, so it should be possible
> to get the path for a mount point, in case that path was not kept during the
> mount(2) operation.
Jorg, maybe I'm missing something but look:
quack:/tmp/foo # l
total 700
drwxr-xr-x 2 root root 4096 2011-12-13 16:54 ./
drwxrwxrwt 74 root root 712704 2011-12-13 16:54 ../
quack:/tmp/foo # mkdir -p bar/baz
quack:/tmp/foo # mkdir bar2
quack:/tmp/foo # mount -t ext3 -o loop ~jack/fs-images/ext3-image bar/baz/
quack:/tmp/foo # mkdir bar/baz/dir
quack:/tmp/foo # touch bar/baz/dir/some_file
quack:/tmp/foo # mount --bind bar/baz/dir/ bar2
quack:/tmp/foo # ls bar2
some_file
quack:/tmp/foo # ls bar/baz/
aquota.group aquota.user dir
quack:/tmp/foo # mount -t ext2 -o loop ~jack/fs-images/ext2-image bar/
quack:/tmp/foo # l bar
total 18
drwxr-xr-x 4 10005 users 1024 2011-02-24 12:18 ./
drwxr-xr-x 4 root root 4096 2011-12-13 16:55 ../
drwx------ 2 root root 12288 2010-03-10 12:21 lost+found/
drwxrwxrwx 6 root root 1024 2011-02-24 12:18 t/
quack:/tmp/foo #
So to summarize we have directory structure like:
/tmp
|
foo
/ \
bar bar2
| |
here is ext2_image here is subtree of 'dir' from ext3_image
And yes, df doesn't work for ext3_image if you do this:
quack:/tmp/foo # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 24843384 8170984 15410424 35% /
devtmpfs 488488 240 488248 1% /dev
tmpfs 489924 544 489380 1% /dev/shm
/dev/mapper/cr_sda3 50007768 36910580 10556904 78% /crypted
df: `/tmp/foo/bar/baz': No such file or directory
/dev/loop1 63461 63461 0 100% /tmp/foo/bar
And yes, if I get into bar/baz and then mount a filesystem over bar,
getcwd returns a path which is not resolvable:
quack:/tmp/foo/bar/baz # pwd
/tmp/foo/bar/baz
quack:/tmp/foo/bar/baz # cd /tmp/foo/bar/baz
bash: cd: /tmp/foo/bar/baz: No such file or directory
So you can do rather insane stuff with directory tree under linux. Most
admins don't but e.g. container guys do and linux dcache is designed to
accomodate this which makes answering some otherwise simple questions
rather complicated.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2011-12-13 16:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <SNT126-DS19FDA9F050C2D5E43731CDBEB40@phx.gbl>
2011-12-07 18:06 ` FW: Symbolic link with absolute target path in UDF - not working properly? Jan Kara
[not found] ` <SNT126-DS1C6361C26AD146EBA3BB6BEBE0@phx.gbl>
2011-12-12 14:18 ` Jan Kara
[not found] ` <SNT126-DS114F372B3DA7DF425B8146BEBC0@phx.gbl>
2011-12-13 11:01 ` Joerg Schilling
2011-12-13 16:13 ` Jan Kara [this message]
2011-12-13 18:30 ` Joerg Schilling
2011-12-13 19:25 ` Jan Kara
2011-12-13 19:54 ` Joerg Schilling
2011-12-13 20:26 ` Al Viro
2011-12-13 22:41 ` Joerg Schilling
2011-12-14 0:45 ` Al Viro
2011-12-14 17:34 ` Joerg Schilling
2011-12-13 20:05 ` Al Viro
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=20111213161303.GE11747@quack.suse.cz \
--to=jack@suse.cz \
--cc=joerg@schily.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=otnaccess@hotmail.com \
--cc=schily@schily.net \
/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).