Whamcloud - gitweb
LU-14854 mdd: proper handle error in mdd_swap_layouts() 19/44319/5
authorBobi Jam <bobijam@whamcloud.com>
Thu, 15 Jul 2021 18:20:54 +0000 (02:20 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Sep 2021 06:30:13 +0000 (06:30 +0000)
Only restore object's HSM xattr on error if it's for
SWAP_LAYOUTS_MDS_HSM.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I9d4c58cd3107c3900e72a0946d0ec7d7286dd43f
Reviewed-on: https://review.whamcloud.com/44319
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdd/mdd_object.c

index 3742191..e431fdf 100644 (file)
@@ -2714,13 +2714,17 @@ out_restore:
                if (rc2 < 0)
                        goto do_lbug;
 
-               ++steps;
-               rc2 = mdd_xattr_hsm_replace(env, fst_o, fst_hsm_buf, handle);
-               if (rc2 < 0)
-                       goto do_lbug;
+               if (flags & SWAP_LAYOUTS_MDS_HSM) {
+                       ++steps;
+                       rc2 = mdd_xattr_hsm_replace(env, fst_o, fst_hsm_buf,
+                                                   handle);
+                       if (rc2 < 0)
+                               goto do_lbug;
 
-               ++steps;
-               rc2 = mdd_xattr_hsm_replace(env, snd_o, snd_hsm_buf, handle);
+                       ++steps;
+                       rc2 = mdd_xattr_hsm_replace(env, snd_o, snd_hsm_buf,
+                                                   handle);
+               }
 
        do_lbug:
                if (rc2 < 0) {