*
* For btrfs subvolumes this function returns NULL, but @fsroot properly set.
*
+ * If @tb is NULL then defaults to '/'.
+ *
* Returns: entry from @tb that will be used as a source for @fs if the @fs is
* bindmount.
*
/*
* btrfs-subvolume mount -- get subvolume name and use it as a root-fs path
*/
- else if (fstype && (!strcmp(fstype, "btrfs") || !strcmp(fstype, "auto"))) {
+ else if (tb && fstype && (!strcmp(fstype, "btrfs") || !strcmp(fstype, "auto"))) {
if (get_btrfs_fs_root(tb, fs, &root) < 0)
goto err;
}
{
struct libmnt_fs *src_fs;
char *fsroot = NULL;
- const char *src;
+ const char *src, *fstype;
int rc = 0;
DBG(UPDATE, ul_debug("setting FS root"));
assert(upd->fs);
assert(fs);
+ fstype = mnt_fs_get_fstype(fs);
+
if (mountflags & MS_BIND) {
if (!upd->mountinfo)
upd->mountinfo = mnt_new_table_from_file(_PATH_PROC_MOUNTINFO);
-
src = mnt_fs_get_srcpath(fs);
if (src) {
rc = mnt_fs_set_bindsrc(upd->fs, src);
if (rc)
goto err;
}
+
+ } else if (fstype && (strcmp(fstype, "btrfs") == 0 || strcmp(fstype, "auto") == 0)) {
+ if (!upd->mountinfo)
+ upd->mountinfo = mnt_new_table_from_file(_PATH_PROC_MOUNTINFO);
}
src_fs = mnt_table_get_fs_root(upd->mountinfo, fs,