Whamcloud - gitweb
LU-15220 utils: fix gcc-11 -Werror=format-truncation= error
[fs/lustre-release.git] / lustre / utils / liblustreapi.c
index 511b48f..ca5debe 100644 (file)
@@ -3670,7 +3670,7 @@ static inline void
 lov_v1v3_pool_name(struct lov_user_md *v1, char *pool_name)
 {
        if (v1->lmm_magic == LOV_USER_MAGIC_V3)
-               snprintf(pool_name, LOV_MAXPOOLNAME, "%s",
+               snprintf(pool_name, LOV_MAXPOOLNAME + 1, "%s",
                         ((struct lov_user_md_v3 *)v1)->lmm_pool_name);
        else
                pool_name[0] = '\0';
@@ -5474,6 +5474,9 @@ static int cb_migrate_mdt_init(char *path, int p, int *dp,
        data.ioc_inlbuf2 = (char *)lmu;
        data.ioc_inllen2 = lmv_user_md_size(lmu->lum_stripe_count,
                                            lmu->lum_magic);
+       /* reach bottom? */
+       if (param->fp_depth == param->fp_max_depth)
+               data.ioc_type = MDS_MIGRATE_NSONLY;
        ret = llapi_ioctl_pack(&data, &rawbuf, sizeof(raw));
        if (ret != 0) {
                llapi_error(LLAPI_MSG_ERROR, ret,
@@ -5515,6 +5518,11 @@ migrate:
        }
 
 out:
+       /* Do not get down anymore? */
+       if (param->fp_depth == param->fp_max_depth)
+               ret = 1;
+       param->fp_depth++;
+
        if (dp != NULL) {
                /*
                 * If the directory is being migration, we need