lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.1501091646400.24821@localhost.localdomain>
Date:	Fri, 9 Jan 2015 16:52:11 +0100 (CET)
From:	Lukáš Czerner <lczerner@...hat.com>
To:	Stefan Hajnoczi <stefanha@...hat.com>
cc:	Al Viro <viro@...IV.linux.org.uk>, kzak@...hat.com,
	Dexuan Cui <decui@...rosoft.com>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
	"'linux-ext4'" <linux-ext4@...r.kernel.org>
Subject: Re: Can one file system be R/W mounted multiple times in Linux?

On Fri, 9 Jan 2015, Stefan Hajnoczi wrote:

> Date: Fri, 9 Jan 2015 12:01:59 +0000
> From: Stefan Hajnoczi <stefanha@...hat.com>
> To: Al Viro <viro@...IV.linux.org.uk>
> Cc: Dexuan Cui <decui@...rosoft.com>,
>     "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
>     'linux-ext4' <linux-ext4@...r.kernel.org>
> Subject: Re: Can one file system be R/W mounted multiple times in Linux?
> 
> On Fri, Jan 09, 2015 at 03:51:23AM +0000, Al Viro wrote:
> > On Fri, Jan 09, 2015 at 03:44:16AM +0000, Dexuan Cui wrote:
> > > The 'mount' utility allows me to mount 1 file systems multiple times at different
> > > mount points, like "mount /dev/sdb1 /a; mount /dev/sdb1 /b".
> > > 
> > > I tried to write from /a and /b at the same time and it seems everything is OK
> > > and no data corruption happens.
> > > I tried only  ext4 only.
> > > 
> > > Can somebody please tell me if this usage is safe?
> > 
> > Yes.
> 
> Can you explain under what conditions mounting the same file system
> twice will work?
> 
> I guess the kernel is looking up the block device and then sharing the
> superblock if the file system is already mounted on this block device?
> 
> If I use two loop devices for the same underlying storage it does not
> work:
> 
>   # mount -o loop /var/tmp/ext4.img /tmp/a
>   # mount -o loop /var/tmp/ext4.img /tmp/b

Because now you have two block devices backed by the same file.
Which as Christoph pointed out is equivalent of accessing it from
two different systems.

What you probably want to do is this:

# losetup --show -f /var/tmp/ext4.img
/dev/loop0

mount /dev/loop0 /tmp/a
mount /dev/loop0 /tmp/b

Now the question is, whether 'mount' can be a bit smarter than that
and just mount the already existing block device instead of creating
new one ? Karel ?

-Lukas


>   # touch /tmp/a/a
>   # ls /tmp/b
>   lost+found
>   # umount /tmp/a
>   # umount /tmp/b
>   # mount -o loop /var/tmp/ext4.img /tmp/a
>   [1078357.297245] EXT4-fs error (device loop0): ext4_lookup:1441: inode #2: comm ls: deleted inode referenced: 12
> 
> Stefan
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ