mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-04 11:24:21 +00:00
Prevent downgrade of format version
Don't let change-format-version decrease the format version. It doesn't have the machinery to go back and migrate newer structures to older structures that would be compatible with code expecting the older version. Signed-off-by: Bryant G. Duffy-Ly <bduffyly@versity.com> [zab@versity.com: split from initial patch with other changes] Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -119,6 +119,16 @@ static int do_change_fmt_vers(struct change_fmt_vers_args *args)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (le64_to_cpu(meta_super->fmt_vers) > args->fmt_vers ||
|
||||
le64_to_cpu(data_super->fmt_vers) > args->fmt_vers) {
|
||||
ret = -EPERM;
|
||||
printf("Downgrade of Meta Format Version: %llu and Data Format Version: %llu to Format Version: %llu is not allowed\n",
|
||||
le64_to_cpu(meta_super->fmt_vers),
|
||||
le64_to_cpu(data_super->fmt_vers),
|
||||
args->fmt_vers);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (le64_to_cpu(meta_super->fmt_vers) != args->fmt_vers) {
|
||||
meta_super->fmt_vers = cpu_to_le64(args->fmt_vers);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user