Whamcloud - gitweb
LU-6866 hsm: prevent migration of HSM archived files
[fs/lustre-release.git] / lustre / mdt / mdt_reint.c
index 3413ebd..2ad5259 100644 (file)
@@ -1547,6 +1547,20 @@ out_lease:
        if (rc != 0)
                GOTO(out_unlock_child, rc);
 
+       /* Migration is incompatible with HSM. */
+       ma->ma_need = MA_HSM;
+       ma->ma_valid = 0;
+       rc = mdt_attr_get_complex(info, mold, ma);
+       if (rc != 0)
+               GOTO(out_unlock_child, rc);
+
+       if ((ma->ma_valid & MA_HSM) && ma->ma_hsm.mh_flags != 0) {
+               rc = -ENOSYS;
+               CERROR("%s: cannot migrate HSM archived file "DFID": rc = %d\n",
+                      mdt_obd_name(info->mti_mdt), PFID(old_fid), rc);
+               GOTO(out_unlock_child, rc);
+       }
+
        ma->ma_need = MA_LMV;
        ma->ma_valid = 0;
        ma->ma_lmv = (union lmv_mds_md *)info->mti_xattr_buf;