diff --git a/include/mount.h b/include/mount.h index 76f4fed00..3e4508715 100644 --- a/include/mount.h +++ b/include/mount.h @@ -22,4 +22,6 @@ extern struct mount_info *lookup_mnt_sdev(unsigned int s_dev); extern struct ns_desc mnt_ns_desc; +extern bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev); + #endif /* __CR_MOUNT_H__ */ diff --git a/mount.c b/mount.c index 5a1a85d59..22b838303 100644 --- a/mount.c +++ b/mount.c @@ -18,6 +18,7 @@ #include "util-pie.h" #include "log.h" #include "mount.h" +#include "mount-btrfs.h" #include "pstree.h" #include "proc_parse.h" #include "image.h" @@ -97,6 +98,19 @@ struct mount_info *lookup_mnt_sdev(unsigned int s_dev) return NULL; } +bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev) +{ + if (st_dev == phys_dev) + return true; + + /* + * BTRFS returns subvolume dev-id instead of + * superblock dev-id so we might need additional + * tests here. + */ + return is_btrfs_subvol(phys_dev, st_dev); +} + /* * Comparer two mounts. Return true if only mount points are differ. * Don't care about root and mountpoints, if bind is true.