Util-Linux package development
 help / color / mirror / Atom feed
From: Stanislav Brabec <sbrabec@suse.cz>
To: util-linux <util-linux@vger.kernel.org>
Cc: "David Sterba" <dsterba@suse.cz>, "Søren Holm" <sgh@sgh.dk>
Subject: [PATCH] fix mount -a on btrfs bind mount
Date: Fri, 27 Nov 2015 18:15:41 +0100	[thread overview]
Message-ID: <56588FBD.9000502@suse.cz> (raw)
In-Reply-To: <56573D53.1020406@suse.cz>

Do not prepend src_root to root for bind mounts on btrfs.

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.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
 libmount/src/tab.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 0df8d49..eeb9c57 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -1247,12 +1247,9 @@ struct libmnt_fs *mnt_table_get_fs_root(struct libmnt_table *tb,
 		 */
 		src_root = mnt_fs_get_root(src_fs);
 		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;
 		}
-- 
2.6.3

-- 
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:[~2015-11-27 17:15 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 ` Stanislav Brabec [this message]
2015-12-02 12:51   ` [PATCH] " Karel Zak
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=56588FBD.9000502@suse.cz \
    --to=sbrabec@suse.cz \
    --cc=dsterba@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