[PATCH] erofs-utils: mount: don't overwrite layer_index with -1 again
hudsonZhu
hudson at cyzhu.com
Thu Oct 9 17:19:13 AEDT 2025
Reviewed-by: Chengyu Zhu <hudsonzhu at tencent.com>
Thanks,
Chengyu
> 2025年10月7日 11:22,Gao Xiang <hsiangkao at linux.alibaba.com> 写道:
>
> Initialize ocicfg only when nbdsrc.type changes to
> EROFSNBD_SOURCE_OCI.
>
> Fixes: 6a7cfdb9cd66 ("erofs-utils: oci: add support for indexing by layer digest")
> Cc: Chengyu Zhu <hudsonzhu at tencent.com>
> Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
> ---
> mount/main.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/mount/main.c b/mount/main.c
> index eb0dd01..e2443f8 100644
> --- a/mount/main.c
> +++ b/mount/main.c
> @@ -83,10 +83,6 @@ static int erofsmount_parse_oci_option(const char *option)
> char *p;
> long idx;
>
> - if (oci_cfg->layer_index == 0 && !oci_cfg->blob_digest &&
> - !oci_cfg->platform && !oci_cfg->username && !oci_cfg->password)
> - oci_cfg->layer_index = -1;
> -
> p = strstr(option, "oci.blob=");
> if (p != NULL) {
> p += strlen("oci.blob=");
> @@ -147,10 +143,6 @@ static int erofsmount_parse_oci_option(const char *option)
> }
> }
> }
> -
> - if (oci_cfg->platform || oci_cfg->username || oci_cfg->password ||
> - oci_cfg->blob_digest || oci_cfg->layer_index >= 0)
> - nbdsrc.type = EROFSNBD_SOURCE_OCI;
> return 0;
> }
> #else
> @@ -191,6 +183,11 @@ static long erofsmount_parse_flagopts(char *s, long flags, char **more)
> *comma = '\0';
>
> if (strncmp(s, "oci", 3) == 0) {
> + /* Initialize ocicfg here iff != EROFSNBD_SOURCE_OCI */
> + if (nbdsrc.type != EROFSNBD_SOURCE_OCI) {
> + nbdsrc.type = EROFSNBD_SOURCE_OCI;
> + nbdsrc.ocicfg.layer_index = -1;
> + }
> err = erofsmount_parse_oci_option(s);
> if (err < 0)
> return err;
> --
> 2.43.5
>
More information about the Linux-erofs
mailing list