|
@@ -58,6 +58,22 @@ static int dev_major_minor(const char *devpath,
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Check if we already have the devmajor:devminor in the mounts
|
|
|
|
+ * If thats the case return true.
|
|
|
|
+ */
|
|
|
|
+static bool dev_exists(FsMountList *mounts, unsigned int devmajor, unsigned int devminor)
|
|
|
|
+{
|
|
|
|
+ FsMount *mount;
|
|
|
|
+
|
|
|
|
+ QTAILQ_FOREACH(mount, mounts, next) {
|
|
|
|
+ if (mount->devmajor == devmajor && mount->devminor == devminor) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
static bool build_fs_mount_list_from_mtab(FsMountList *mounts, Error **errp)
|
|
static bool build_fs_mount_list_from_mtab(FsMountList *mounts, Error **errp)
|
|
{
|
|
{
|
|
struct mntent *ment;
|
|
struct mntent *ment;
|
|
@@ -88,6 +104,10 @@ static bool build_fs_mount_list_from_mtab(FsMountList *mounts, Error **errp)
|
|
/* Skip bind mounts */
|
|
/* Skip bind mounts */
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if (dev_exists(mounts, devmajor, devminor)) {
|
|
|
|
+ /* Skip already existing devices (bind mounts) */
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
mount = g_new0(FsMount, 1);
|
|
mount = g_new0(FsMount, 1);
|
|
mount->dirname = g_strdup(ment->mnt_dir);
|
|
mount->dirname = g_strdup(ment->mnt_dir);
|
|
@@ -171,6 +191,11 @@ bool build_fs_mount_list(FsMountList *mounts, Error **errp)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (dev_exists(mounts, devmajor, devminor)) {
|
|
|
|
+ /* Skip already existing devices (bind mounts) */
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
mount = g_new0(FsMount, 1);
|
|
mount = g_new0(FsMount, 1);
|
|
mount->dirname = g_strdup(line + dir_s);
|
|
mount->dirname = g_strdup(line + dir_s);
|
|
mount->devtype = g_strdup(dash + type_s);
|
|
mount->devtype = g_strdup(dash + type_s);
|