]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix mnt_table_is_fs_mounted() for rbind
authorKarel Zak <kzak@redhat.com>
Wed, 3 Jan 2018 12:59:59 +0000 (13:59 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 3 Jan 2018 13:02:27 +0000 (14:02 +0100)
There is no difference between "bind" and "rbind" if we want to FS
root to search for the FS in mountinfo file.

fstab:

 /dev/sdc1       /mnt/foo        xfs     defaults        0 0
 /mnt/foo        /mnt/test       none    rw,rbind        0 0

use -a more than once:

  mount -a
  mount -a

/proc/mounts (the current result):

 /dev/sdc1 /mnt/foo xfs rw,relatime,attr2,inode64,noquota 0 0
 /dev/sdc1 /mnt/test xfs rw,relatime,attr2,inode64,noquota 0 0
 /dev/sdc1 /mnt/test xfs rw,relatime,attr2,inode64,noquota 0 0
 /dev/sdc1 /mnt/foo xfs rw,relatime,attr2,inode64,noquota 0 0

expected (fixed version) result:

 /dev/sdc1 /mnt/foo xfs rw,relatime,attr2,inode64,noquota 0 0
 /dev/sdc1 /mnt/test xfs rw,relatime,attr2,inode64,noquota 0 0

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1528959
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/tab.c

index 760b95b5fb4a9111977688d579b63aad2f74393c..968057e429f52ba52b907cfa83fd7d636b4807b7 100644 (file)
@@ -1561,7 +1561,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
                struct libmnt_fs *rootfs;
                int flags = 0;
 
-               if (mnt_fs_get_option(fstab_fs, "bind", NULL, NULL) == 0)
+               if (mnt_fs_get_option(fstab_fs, "bind", NULL, NULL) == 0 ||
+                   mnt_fs_get_option(fstab_fs, "rbind", NULL, NULL) == 0)
                        flags = MS_BIND;
 
                rootfs = mnt_table_get_fs_root(tb, fstab_fs, flags, &root);