`-Edot-omitted` enables `-E48bits`, which requires specific
configurations for g_sbi.{epoch, build_time}. Currently, the call to
`erofs_sb_set_48bit()` occurs too late in the execution flow, causing
the aforementioned logic to be bypassed and resulting in incorrect
mtimes for all inodes.

This patch moves `erofs_sb_set_48bit()` forward to the options parsing
stage to resolve this issue.

Signed-off-by: Yifan Zhao <[email protected]>
---
v2:
- Fix mis-formatted commit msg, oops..

 lib/importer.c | 2 --
 mkfs/main.c    | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/importer.c b/lib/importer.c
index 958a433..cd71a21 100644
--- a/lib/importer.c
+++ b/lib/importer.c
@@ -81,8 +81,6 @@ int erofs_importer_init(struct erofs_importer *im)
                        goto out_err;
        }
 
-       if (params->dot_omitted)
-               erofs_sb_set_48bit(sbi);
        return 0;
 
 out_err:
diff --git a/mkfs/main.c b/mkfs/main.c
index 620b1ed..347cdcb 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -428,6 +428,8 @@ static int erofs_mkfs_feat_set_dot_omitted(struct 
erofs_importer_params *params,
                return -EINVAL;
 
        mkfs_dot_omitted = en;
+       if (en)
+               erofs_sb_set_48bit(&g_sbi);
        return 0;
 }
 
-- 
2.47.3


Reply via email to