Whamcloud - gitweb
LU-9403 mdt: prevent HSM leak on re-archive 66/26866/2
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 27 Apr 2017 15:23:26 +0000 (10:23 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 9 May 2017 03:47:00 +0000 (03:47 +0000)
In mdt_hsm_is_action_compat() if the file to be archived already
exists in some backend archive then ensure that the re-archive
uses the same backend archive.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ifc0ef03264a20557c31df7add9e34a1dc1f0c814
Reviewed-on: https://review.whamcloud.com/26866
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Quentin Bouget <quentin.bouget@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_coordinator.c
lustre/mdt/mdt_internal.h

index 5637ffb..7156c7d 100644 (file)
@@ -1660,13 +1660,13 @@ out_env:
 /**
  * check if a request is compatible with file status
  * \param hai [IN] request description
- * \param hal_an [IN] request archive number (not used)
+ * \param archive_id [IN] request archive id
  * \param rq_flags [IN] request flags
  * \param hsm [IN] file HSM metadata
  * \retval boolean
  */
 bool mdt_hsm_is_action_compat(const struct hsm_action_item *hai,
-                             const int hal_an, const __u64 rq_flags,
+                             u32 archive_id, u64 rq_flags,
                              const struct md_hsm *hsm)
 {
        int      is_compat = false;
@@ -1679,6 +1679,12 @@ bool mdt_hsm_is_action_compat(const struct hsm_action_item *hai,
                if (!(hsm_flags & HS_NOARCHIVE) &&
                    (hsm_flags & HS_DIRTY || !(hsm_flags & HS_ARCHIVED)))
                        is_compat = true;
+
+               if (hsm_flags & HS_EXISTS &&
+                   archive_id != 0 &&
+                   archive_id != hsm->mh_arch_id)
+                       is_compat = false;
+
                break;
        case HSMA_RESTORE:
                if (!(hsm_flags & HS_DIRTY) && (hsm_flags & HS_RELEASED) &&
index 89d89ac..9ddf663 100644 (file)
@@ -876,7 +876,7 @@ struct mdt_object *mdt_hsm_get_md_hsm(struct mdt_thread_info *mti,
 int mdt_hsm_add_hal(struct mdt_thread_info *mti,
                    struct hsm_action_list *hal, struct obd_uuid *uuid);
 bool mdt_hsm_is_action_compat(const struct hsm_action_item *hai,
-                             const int hal_an, const __u64 rq_flags,
+                             u32 archive_id, u64 rq_flags,
                              const struct md_hsm *hsm);
 int mdt_hsm_update_request_state(struct mdt_thread_info *mti,
                                 struct hsm_progress_kernel *pgs,