From: Karel Zak <kzak@redhat.com>
To: Stanislav Brabec <sbrabec@suse.cz>
Cc: util-linux <util-linux@vger.kernel.org>,
"David Sterba" <dsterba@suse.cz>, "Søren Holm" <sgh@sgh.dk>
Subject: Re: [PATCH] fix mount -a on btrfs bind mount
Date: Wed, 2 Dec 2015 13:51:17 +0100 [thread overview]
Message-ID: <20151202125117.GJ4955@ws.net.home> (raw)
In-Reply-To: <56588FBD.9000502@suse.cz>
On Fri, Nov 27, 2015 at 06:15:41PM +0100, Stanislav Brabec wrote:
> root has to be literally the same as src_root, which is already the path
> prefixed by /{subvolume}. Otherwise it will not match in
> mnt_fs_streq_target(fs, xtgt) inside mnt_table_is_fs_mounted() and
> repeated "mount -a" will mount it again and again.
yes
> if (src_root && !startswith(root, src_root)) {
> - size_t sz = strlen(root) + strlen(src_root) + 1;
> - char *tmp = malloc(sz);
> -
> + char *tmp = strdup (src_root);
> if (!tmp)
> goto err;
> - snprintf(tmp, sz, "%s%s", src_root, root);
> free(root);
> root = tmp;
> }
but this code is there for another use case. The problem is when the
fstab_fs source is *sub-directory* on btrfs subvolume (or another bind
mount). For example imagine:
/dev/sdc /mnt/test btrfs subvol=/anydir
/mnt/test/foo /mnt/test2 auto bind
then FS root for /mnt/test2 is /anydir/foo on /dev/sdc. The problem is
that the code does not recognize your use-case with "/" (no sub-directory
on source FS).
My bugfix:
https://github.com/karelzak/util-linux/commit/352740e88e2c9cb180fe845ce210b1c7b5ad88c7
try it :-)
Anyway, we need more regression tests for these crazy use-cases.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2015-12-02 12:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 17:11 [PATCH?] fix mount -a on btrfs bind mount Stanislav Brabec
2015-11-27 17:15 ` [PATCH] " Stanislav Brabec
2015-12-02 12:51 ` Karel Zak [this message]
2015-12-02 16:26 ` Stanislav Brabec
2015-12-04 14:32 ` David Sterba
-- strict thread matches above, loose matches on Subject: below --
2015-11-26 17:00 [PATCH?] " Stanislav Brabec
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=20151202125117.GJ4955@ws.net.home \
--to=kzak@redhat.com \
--cc=dsterba@suse.cz \
--cc=sbrabec@suse.cz \
--cc=sgh@sgh.dk \
--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