Whamcloud - gitweb
LU-14719 utils: dir migration stop on error 40/47040/3
authorLai Siyao <lai.siyao@whamcloud.com>
Tue, 29 Mar 2022 23:41:23 +0000 (19:41 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 1 Sep 2022 05:52:47 +0000 (05:52 +0000)
Once directory migration fails, it should stop immediately since
current migration won't succceed, and subsequent migration may
fail on the same error.

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I96c1693d1b1da0856c925b9b22c1ab7f3181f0d8
Reviewed-on: https://review.whamcloud.com/47040
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre/lustreapi.h
lustre/utils/liblustreapi.c

index caaa780..84b01e3 100644 (file)
@@ -341,7 +341,7 @@ struct find_param {
                                 fp_newerxy:1,
                                 fp_exclude_btime:1,
                                 fp_exclude_perm:1,
-                                fp_unused_bit4:1, /* Once all unused fields  */
+                                fp_stop_on_error:1, /* stop iteration on error */
                                 fp_unused_bit5:1, /* are used we need to add */
                                 fp_unused_bit6:1, /* a separate flag field at*/
                                 fp_unused_bit7:1; /* the end of the struct.  */
index 4d4b1f1..1cd3b5b 100644 (file)
@@ -2269,9 +2269,12 @@ static int llapi_semantic_traverse(char *path, int size, int parent,
                        break;
                case DT_DIR:
                        rc = llapi_semantic_traverse(path, size, d, sem_init,
-                                                     sem_fini, data, dent);
+                                                    sem_fini, data, dent);
                        if (rc != 0 && ret == 0)
                                ret = rc;
+                       if (rc < 0 && rc != -EALREADY &&
+                           param->fp_stop_on_error)
+                               goto out;
                        break;
                default:
                        rc = 0;
@@ -2279,6 +2282,9 @@ static int llapi_semantic_traverse(char *path, int size, int parent,
                                rc = sem_init(path, d, NULL, data, dent);
                                if (rc < 0 && ret == 0) {
                                        ret = rc;
+                                       if (rc && rc != -EALREADY &&
+                                           param->fp_stop_on_error)
+                                               goto out;
                                        break;
                                }
                        }
@@ -6076,6 +6082,7 @@ out:
 
 int llapi_migrate_mdt(char *path, struct find_param *param)
 {
+       param->fp_stop_on_error = 1;
        return param_callback(path, cb_migrate_mdt_init, cb_migrate_mdt_fini,
                              param);
 }