Util-Linux package development
 help / color / mirror / Atom feed
From: Stanislav Brabec <sbrabec@suse.cz>
To: Karel Zak <kzak@redhat.com>
Cc: Ruediger Meier <sweet_f_a@gmx.de>,
	util-linux@vger.kernel.org, David Sterba <dsterba@suse.cz>
Subject: Re: [PATCH] tests: add test for loop option in fstab
Date: Wed, 24 Feb 2016 19:58:08 +0100	[thread overview]
Message-ID: <56CDFD40.7020603@suse.cz> (raw)
In-Reply-To: <56CB3909.4080808@suse.cz>

On Feb 22, 2016 at 17:36 Stanislav Brabec wrote:
> No, My new testcase fails on a system with mtab being a symlink:
>
> # ls -al /etc/mtab
> lrwxrwxrwx 1 root root 19 Jul  7  2015 /etc/mtab -> ../proc/self/mounts
>
> Not tested with a file.
>
I just analyzed the loop test case failure in deep. It has nothing to
do with mtab, but with a fact, that manual losetup with subsequent
mount commands recycle the same loop device, but -oloop allocates new
loop device for each mount where loop option is used.

And it is something that kernel does not like.

Here is a simplified example:
# losetup /dev/loop0 tests/output/mount/fstab-btrfs.img
# losetup /dev/loop1 tests/output/mount/fstab-btrfs.img
# mount /dev/loop0 /mnt/0
# mount -osubvol=/ /dev/loop1 /mnt/1
mount: /dev/loop1 is already mounted or /mnt/1 busy
        /dev/loop1 is already mounted on /mnt/1

Note: default of fstab-btrfs.img is not /, each mount should mount a
different sub-volume.

David, is it an expected kernel behavior?

If not, it is a kernel bug.

If yes, util-linux needs additional logic:

If "loop" options is used, check, whether the source equals to a source
of another loop mount. If it is, don't allocate new loop device, but
recycle existing one.

And reciprocally, if umount on such device is used, don't free the loop
device as long as there is another volume mounted that shares this
source.

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.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

  reply	other threads:[~2016-02-24 18:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 19:45 [PATCH] tests: add test for loop option in fstab Stanislav Brabec
2016-02-12 10:10 ` Karel Zak
2016-02-12 15:28 ` Ruediger Meier
2016-02-12 15:55   ` Stanislav Brabec
2016-02-15 11:42 ` Ruediger Meier
2016-02-16 14:49   ` Karel Zak
2016-02-19 18:27     ` Stanislav Brabec
2016-02-22 10:12       ` Karel Zak
2016-02-22 10:29         ` Ruediger Meier
2016-02-22 10:53           ` Karel Zak
2016-02-22 16:36         ` Stanislav Brabec
2016-02-24 18:58           ` Stanislav Brabec [this message]
2016-02-24 21:33             ` [PATCH] tests: add test for loop option in fstab (my mistake, and two new bugs, one in kernel) Stanislav Brabec
2016-02-25 19:31               ` Stanislav Brabec
2016-03-01 15:26                 ` Stanislav Brabec
  -- strict thread matches above, loose matches on Subject: below --
2016-02-12 16:23 [PATCH] tests: add test for loop option in fstab Ruediger Meier

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=56CDFD40.7020603@suse.cz \
    --to=sbrabec@suse.cz \
    --cc=dsterba@suse.cz \
    --cc=kzak@redhat.com \
    --cc=sweet_f_a@gmx.de \
    --cc=util-linux@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