Some control must be added in procfs interface to
ensure that the coordinator state will be kept accurate.
Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: I41e5b42ddbdbcb652c202ee01fa120126e78f3d2
Reviewed-on: http://review.whamcloud.com/8074
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
rc = mdt_hsm_cdt_start(mdt);
}
} else if (strncmp(buffer, CDT_STOP_CMD, strlen(CDT_STOP_CMD)) == 0) {
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) {
} 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) {
} 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) {