mirror of https://github.com/digint/btrbk
btrbk: fix: "readonly" is required key for "btrfs subvolume show" output
The "Flags: readonly|-" line is present as of btrfs-progs v4.6.1, and is required in "target metadata check" of btrfs_send_receive().pull/293/head
parent
74be074e6f
commit
73108d2309
9
btrbk
9
btrbk
|
@ -1006,12 +1006,16 @@ sub btrfs_subvolume_show($;@)
|
|||
}
|
||||
DEBUG "Parsed " . scalar(keys %detail) . " subvolume detail items: $vol->{PRINT}";
|
||||
|
||||
# NOTE: as of btrfs-progs v4.6.1, flags are either "-" or "readonly"
|
||||
$detail{readonly} = ($detail{flags} =~ /readonly/) ? 1 : 0 if($detail{flags});
|
||||
|
||||
# validate required keys
|
||||
unless((defined($detail{parent_uuid}) && (($detail{parent_uuid} eq '-') || ($detail{parent_uuid} =~ /^$uuid_match$/))) &&
|
||||
(defined($detail{id}) && ($detail{id} =~ /^\d+$/) && ($detail{id} >= 5)) &&
|
||||
(defined($detail{gen}) && ($detail{gen} =~ /^\d+$/)) &&
|
||||
(defined($detail{cgen}) && ($detail{cgen} =~ /^\d+$/)) &&
|
||||
(defined($detail{top_level}) && ($detail{top_level} =~ /^\d+$/)))
|
||||
(defined($detail{top_level}) && ($detail{top_level} =~ /^\d+$/)) &&
|
||||
(defined($detail{readonly})))
|
||||
{
|
||||
ERROR "Failed to parse subvolume detail (unsupported btrfs-progs) for: $vol->{PRINT}";
|
||||
return undef;
|
||||
|
@ -1036,9 +1040,6 @@ sub btrfs_subvolume_show($;@)
|
|||
return undef;
|
||||
}
|
||||
|
||||
# NOTE: as of btrfs-progs v4.6.1, flags are either "-" or "readonly"
|
||||
$detail{readonly} = ($detail{flags} =~ /readonly/) ? 1 : 0;
|
||||
|
||||
VINFO(\%detail, "detail") if($loglevel >=4);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue