From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: FW: Symbolic link with absolute target path in UDF - not working properly? Date: Tue, 13 Dec 2011 20:25:26 +0100 Message-ID: <20111213192526.GA20267@quack.suse.cz> References: <20111207180637.GM4622@quack.suse.cz> <20111212141817.GA5473@quack.suse.cz> <4ee73093.ByQYnWpgRk/yNHIS%schily@schily.net> <20111213161303.GE11747@quack.suse.cz> <4ee799c8.IGU4Fg9P4wlTkYIO%schily@schily.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jack@suse.cz, otnaccess@hotmail.com, linux-fsdevel@vger.kernel.org, joerg@schily.net To: Joerg Schilling Return-path: Received: from cantor2.suse.de ([195.135.220.15]:34546 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751871Ab1LMTZ2 (ORCPT ); Tue, 13 Dec 2011 14:25:28 -0500 Content-Disposition: inline In-Reply-To: <4ee799c8.IGU4Fg9P4wlTkYIO%schily@schily.net> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue 13-12-11 19:30:32, Joerg Schilling wrote: > Jan Kara wrote: > > > > 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 > > This looks loks a loopback mount. The first mount is the loopback one, right. But that's not really interesting. What is interesting is the second mount --bind which allows you to mount arbitrary *directory* over some other directory in the system. So you have two (consistent) copies of one directory and it's subtree in the system. > > 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 > > If this is implemented the way it is implemented in Solaris, there is a > nearly empty vfs layer, specific to the loopback mount that indirectly > calls the vfs functions for the base FS. So on Solaris this is > possible and it would work as expected. Again, note that loopback mounts are not the hard part here. I could have mounted standard block devices and nothing interesting would have changed in my example. What is interesting is that I can create a directory tree where root of some filesystem is not accessible (there is not a valid path that would resolve to it) but it's subdirectory is accessible. Honza -- Jan Kara SUSE Labs, CR