Whamcloud - gitweb
LU-14689 hsm: starting running HSM coordinator should success 20/43720/2
authorLi Xi <lixi@ddn.com>
Mon, 17 May 2021 14:49:55 +0000 (22:49 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 27 May 2021 18:18:47 +0000 (18:18 +0000)
When starting a running coordinator, the command should succeed
no matter how many times the command runs.

And this should be the same for stopping a stopped coordinator.

Signed-off-by: Li Xi <lixi@ddn.com>
Change-Id: I99169de35d6fcc11e03604ac63cdc4358e25b3d2
Reviewed-on: https://review.whamcloud.com/43720
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sergey Cheremencev <sergey.cheremencev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_coordinator.c

index 327cd59..1420cb1 100644 (file)
@@ -2241,15 +2241,18 @@ ssize_t hsm_control_store(struct kobject *kobj, struct attribute *attr,
                        rc = set_cdt_state(cdt, CDT_RUNNING);
                        mdt_hsm_cdt_event(cdt);
                        wake_up(&cdt->cdt_waitq);
+               } else if (cdt->cdt_state == CDT_RUNNING) {
+                       rc = 0;
                } else {
                        rc = mdt_hsm_cdt_start(mdt);
                }
        } else if (strncmp(buffer, CDT_STOP_CMD, strlen(CDT_STOP_CMD)) == 0) {
-               if ((cdt->cdt_state == CDT_STOPPING) ||
-                   (cdt->cdt_state == CDT_STOPPED)) {
-                       CERROR("%s: Coordinator already stopped\n",
+               if (cdt->cdt_state == CDT_STOPPING) {
+                       CERROR("%s: Coordinator is already stopping\n",
                               mdt_obd_name(mdt));
                        rc = -EALREADY;
+               } else if (cdt->cdt_state == CDT_STOPPED) {
+                       rc = 0;
                } else {
                        rc = mdt_hsm_cdt_stop(mdt);
                }