[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56D0BCFC.5020302@suse.cz>
Date: Fri, 26 Feb 2016 22:00:44 +0100
From: Stanislav Brabec <sbrabec@...e.cz>
To: Al Viro <viro@...IV.linux.org.uk>,
"Austin S. Hemmelgarn" <ahferroin7@...il.com>
Cc: linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
Btrfs BTRFS <linux-btrfs@...r.kernel.org>,
David Sterba <dsterba@...e.cz>
Subject: Re: loop subsystem corrupted after mounting multiple btrfs
sub-volumes
On Feb 26, 2016 at 21:30 Al Viro wrote:
> IMO on-demand losetup a-la -o loop is simply a bad idea...
So the correct behavior of -o loop should:
Check, whether another mount command already did losetup.
If not, allocate new loop device.
If yes, reuse existing loop device.
Well, it seems to be safe, even if the loop device was not allocated by
mount(8) itself, as
ioctl(fd, LOOP_CLR_FD)
never returns EBUSY:
# losetup /dev/loop2 /ext4.img
# mount /dev/loop2 /mnt
# strace losetup -d /dev/loop2 2>&1 | tail -n7 | head -n3
open("/dev/loop2", O_RDONLY|O_CLOEXEC) = 3
ioctl(3, LOOP_CLR_FD) = 0
close(3) = 0
If the recycling "alien" loop devices will not be considered as a good
idea, then (if possible):
If the loop device was allocated by mount(8) itself, recycle it.
If the loop device was not allocated by mount(8) itself, return error.
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@...e.com
Lihovarská 1060/12 tel: +49 911 7405384547
190 00 Praha 9 fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
Powered by blists - more mailing lists