Whamcloud - gitweb
LU-8735 llite: Return -ERESTARTSYS in range_lock()
[fs/lustre-release.git] / lustre / utils / liblustreapi_hsm.c
index 0b12f37..8fe05b4 100644 (file)
@@ -6,7 +6,7 @@
  * (C) Copyright 2012 Commissariat a l'energie atomique et aux energies
  *     alternatives
  *
- * Copyright (c) 2013, 2015, Intel Corporation.
+ * Copyright (c) 2013, 2016, Intel Corporation.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the GNU Lesser General Public License
@@ -429,11 +429,12 @@ static int llapi_hsm_log_ct_progress(struct hsm_copyaction_private **phcp,
                        goto err;
        }
 
-       if (progress_type == CT_RUNNING)
+       if (progress_type == CT_RUNNING) {
                rc = llapi_json_add_item(&json_items, "current_bytes",
                                         LLAPI_JSON_BIGNUM, &current);
                if (rc < 0)
                        goto err;
+       }
 
 cancel:
        rc = llapi_json_add_item(&json_items, "event_type", LLAPI_JSON_STRING,
@@ -1125,12 +1126,18 @@ int llapi_hsm_action_begin(struct hsm_copyaction_private **phcp,
                        goto err_out;
        }
 
+       /* Since remove is atomic there is no need to send an initial
+        * MDS_HSM_PROGRESS RPC. */
+       if (hai->hai_action == HSMA_REMOVE)
+               goto out_log;
+
        rc = ioctl(ct->mnt_fd, LL_IOC_HSM_COPY_START, &hcp->copy);
        if (rc < 0) {
                rc = -errno;
                goto err_out;
        }
 
+out_log:
        llapi_hsm_log_ct_progress(&hcp, hai, CT_START, 0, 0);
 
 ok_out: