adding a possibility to disable ELC through procfs, for test purposes only.
Change-Id: I45153d67f325bd464943c8f618d5c86dd663166e
Reviewed-by: Andrew Perepechko <Andrew_Perepechko@xyratex.com>
Reviewed-by: Alexander Zarochentsev <Alexander_Zarochentsev@xyratex.com>
Signed-off-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Xyratex-bug-id: MRP-477
Reviewed-on: http://review.whamcloud.com/3188
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
return ns->ns_client == LDLM_NAMESPACE_SERVER;
}
+static inline int ns_connect_cancelset(struct ldlm_namespace *ns)
+{
+ LASSERT(ns != NULL);
+ return !!(ns->ns_connect_flags & OBD_CONNECT_CANCELSET);
+}
+
static inline int ns_connect_lru_resize(struct ldlm_namespace *ns)
{
LASSERT(ns != NULL);
if (cancels == NULL)
cancels = &head;
- if (exp_connect_cancelset(exp)) {
+ if (ns_connect_cancelset(ns)) {
/* Estimate the amount of available space in the request. */
req_capsule_filled_sizes(pill, RCL_CLIENT);
avail = ldlm_capsule_handles_avail(pill, RCL_CLIENT, canceloff);
RETURN(rc);
}
- if (exp_connect_cancelset(exp)) {
+ if (ns_connect_cancelset(ns)) {
if (canceloff) {
dlm = req_capsule_client_get(pill, &RMF_DLM_REQ);
LASSERT(dlm);
return count;
}
+static int lprocfs_rd_elc(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct ldlm_namespace *ns = data;
+ unsigned int supp = ns_connect_cancelset(ns);
+
+ return lprocfs_rd_uint(page, start, off, count, eof, &supp);
+}
+
+static int lprocfs_wr_elc(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct ldlm_namespace *ns = data;
+ unsigned int supp = -1;
+ int rc;
+
+ rc = lprocfs_wr_uint(file, buffer, count, &supp);
+ if (rc < 0)
+ return rc;
+
+ if (supp == 0)
+ ns->ns_connect_flags &= ~OBD_CONNECT_CANCELSET;
+ else if (ns->ns_orig_connect_flags & OBD_CONNECT_CANCELSET)
+ ns->ns_connect_flags |= OBD_CONNECT_CANCELSET;
+ return count;
+}
+
void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns)
{
struct proc_dir_entry *dir;
lock_vars[0].read_fptr = lprocfs_rd_uint;
lock_vars[0].write_fptr = lprocfs_wr_uint;
lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
+
+ snprintf(lock_name, MAX_STRING_SIZE, "%s/early_lock_cancel",
+ ldlm_ns_name(ns));
+ lock_vars[0].data = ns;
+ lock_vars[0].read_fptr = lprocfs_rd_elc;
+ lock_vars[0].write_fptr = lprocfs_wr_elc;
+ lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
} else {
snprintf(lock_name, MAX_STRING_SIZE, "%s/ctime_age_limit",
ldlm_ns_name(ns));
cfs_list_t *cancels, ldlm_mode_t mode,
__u64 bits)
{
+ struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
ldlm_policy_data_t policy = {{0}};
struct ldlm_res_id res_id;
struct ldlm_resource *res;
int count;
ENTRY;
+ /* Return, i.e. cancel nothing, only if ELC is supported (flag in
+ * export) but disabled through procfs (flag in NS).
+ *
+ * This distinguishes from a case when ELC is not supported originally,
+ * when we still want to cancel locks in advance and just cancel them
+ * locally, without sending any RPC. */
+ if (exp_connect_cancelset(exp) && !ns_connect_cancelset(ns))
+ RETURN(0);
+
fid_build_reg_res_name(fid, &res_id);
res = ldlm_resource_get(exp->exp_obd->obd_namespace,
NULL, &res_id, 0, 0);
int count;
ENTRY;
+ /* Return, i.e. cancel nothing, only if ELC is supported (flag in
+ * export) but disabled through procfs (flag in NS).
+ *
+ * This distinguishes from a case when ELC is not supported originally,
+ * when we still want to cancel locks in advance and just cancel them
+ * locally, without sending any RPC. */
+ if (exp_connect_cancelset(exp) && !ns_connect_cancelset(ns))
+ RETURN(0);
+
osc_build_res_name(oa->o_id, oa->o_seq, &res_id);
res = ldlm_resource_get(ns, NULL, &res_id, 0, 0);
if (res == NULL)