From: Bruno Faccini Date: Sat, 26 Oct 2013 05:59:39 +0000 (+0200) Subject: LU-4065 mdt: Ensure accurate coordinator state X-Git-Tag: 2.5.52~67 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=2edc131c4d00809d0afd7606e503ebae6f0618d8 LU-4065 mdt: Ensure accurate coordinator state Some control must be added in procfs interface to ensure that the coordinator state will be kept accurate. Signed-off-by: Bruno Faccini Change-Id: I41e5b42ddbdbcb652c202ee01fa120126e78f3d2 Reviewed-on: http://review.whamcloud.com/8074 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Jinshan Xiong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index b11723d..87a5f3e 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -1984,10 +1984,24 @@ int lprocfs_wr_hsm_cdt_control(struct file *file, const char *buffer, rc = mdt_hsm_cdt_start(mdt); } } else if (strncmp(buffer, CDT_STOP_CMD, strlen(CDT_STOP_CMD)) == 0) { - cdt->cdt_state = CDT_STOPPING; + if ((cdt->cdt_state == CDT_STOPPING) || + (cdt->cdt_state == CDT_STOPPED)) { + CERROR("%s: Coordinator already stopped\n", + mdt_obd_name(mdt)); + rc = -EALREADY; + } else { + cdt->cdt_state = CDT_STOPPING; + } } else if (strncmp(buffer, CDT_DISABLE_CMD, strlen(CDT_DISABLE_CMD)) == 0) { - cdt->cdt_state = CDT_DISABLE; + if ((cdt->cdt_state == CDT_STOPPING) || + (cdt->cdt_state == CDT_STOPPED)) { + CERROR("%s: Coordinator is stopped\n", + mdt_obd_name(mdt)); + rc = -EINVAL; + } else { + cdt->cdt_state = CDT_DISABLE; + } } else if (strncmp(buffer, CDT_PURGE_CMD, strlen(CDT_PURGE_CMD)) == 0) { rc = hsm_cancel_all_actions(mdt); } else if (strncmp(buffer, CDT_HELP_CMD, strlen(CDT_HELP_CMD)) == 0) {