From: Li Xi Date: Mon, 17 May 2021 14:49:55 +0000 (+0800) Subject: LU-14689 hsm: starting running HSM coordinator should success X-Git-Tag: 2.14.52~41 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=dda7ceef26d0ee96636ceaa09e1f7d2ce32d5da0 LU-14689 hsm: starting running HSM coordinator should success 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 Change-Id: I99169de35d6fcc11e03604ac63cdc4358e25b3d2 Reviewed-on: https://review.whamcloud.com/43720 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Sergey Cheremencev Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 327cd59..1420cb1 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -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); }