mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-22 14:13:04 +00:00
btrfs-progs: subvol set-default: change id to 5 if specified as 0
The id 0 of the default subvolume is an internal alias for the toplevel
fs tree, kernel does that conversion. Until 2116398b1d
("btrfs-progs:
use libbtrfsutil for set-default") there was no manual conversion and
the value was passed to kernel as-is. With the switch to the
libbtrfsutil API this got broken (4.19).
$ btrfs subvol set-default 0 /path
In this case the default subvolume would be containing subvolume of
/path instead of the toplevel one.
Fix it by manually switching the 0 to 5 in case user specifies that to
avoid the difference in the API, that we can't change.
Issue: #327
Reported-by: Chris Murphy
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
d2316fdfd2
commit
3c49295e8a
@ -947,6 +947,13 @@ static int cmd_subvol_set_default(const struct cmd_struct *cmd,
|
||||
} else {
|
||||
/* subvol id and path to the filesystem are specified */
|
||||
objectid = arg_strtou64(argv[optind]);
|
||||
/*
|
||||
* To avoid confusion with the case above inside libbtrfsutil,
|
||||
* we must set the toplevel as default manually, same what
|
||||
* would kernel do.
|
||||
*/
|
||||
if (objectid == 0)
|
||||
objectid = BTRFS_FS_TREE_OBJECTID;
|
||||
path = argv[optind + 1];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user