Commit f261f48a authored by Fan Yong's avatar Fan Yong Committed by Greg Kroah-Hartman

staging/lustre/ldlm: drop redundant ibits lock interoperability check

In very old release (older than Lustre-1.8), if the client talks with
the server that does not support ibits lock, then the client needs to
convert it as plain lock. Such interoperability check and convertion
is out of date for a long time. Drop it.
Signed-off-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-on: http://review.whamcloud.com/11004
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4971Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarwangdi <di.wang@intel.com>
Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6aa51072
......@@ -402,6 +402,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
#define OBD_FAIL_TGT_LAST_REPLAY 0x710
#define OBD_FAIL_TGT_CLIENT_ADD 0x711
#define OBD_FAIL_TGT_RCVG_FLAG 0x712
#define OBD_FAIL_TGT_DELAY_CONDITIONAL 0x713
#define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800
#define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
......
......@@ -613,50 +613,12 @@ EXPORT_SYMBOL(__ldlm_handle2lock);
*/
void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc)
{
struct obd_export *exp = lock->l_export ?: lock->l_conn_export;
/* INODEBITS_INTEROP: If the other side does not support
* inodebits, reply with a plain lock descriptor. */
if ((lock->l_resource->lr_type == LDLM_IBITS) &&
(exp && !(exp_connect_flags(exp) & OBD_CONNECT_IBITS))) {
/* Make sure all the right bits are set in this lock we
are going to pass to client */
LASSERTF(lock->l_policy_data.l_inodebits.bits ==
(MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE |
MDS_INODELOCK_LAYOUT),
"Inappropriate inode lock bits during conversion %llu\n",
lock->l_policy_data.l_inodebits.bits);
ldlm_res2desc(lock->l_resource, &desc->l_resource);
desc->l_resource.lr_type = LDLM_PLAIN;
/* Convert "new" lock mode to something old client can
understand */
if ((lock->l_req_mode == LCK_CR) ||
(lock->l_req_mode == LCK_CW))
desc->l_req_mode = LCK_PR;
else
desc->l_req_mode = lock->l_req_mode;
if ((lock->l_granted_mode == LCK_CR) ||
(lock->l_granted_mode == LCK_CW)) {
desc->l_granted_mode = LCK_PR;
} else {
/* We never grant PW/EX locks to clients */
LASSERT((lock->l_granted_mode != LCK_PW) &&
(lock->l_granted_mode != LCK_EX));
desc->l_granted_mode = lock->l_granted_mode;
}
/* We do not copy policy here, because there is no
policy for plain locks */
} else {
ldlm_res2desc(lock->l_resource, &desc->l_resource);
desc->l_req_mode = lock->l_req_mode;
desc->l_granted_mode = lock->l_granted_mode;
ldlm_convert_policy_to_wire(lock->l_resource->lr_type,
&lock->l_policy_data,
&desc->l_policy_data);
}
ldlm_res2desc(lock->l_resource, &desc->l_resource);
desc->l_req_mode = lock->l_req_mode;
desc->l_granted_mode = lock->l_granted_mode;
ldlm_convert_policy_to_wire(lock->l_resource->lr_type,
&lock->l_policy_data,
&desc->l_policy_data);
}
EXPORT_SYMBOL(ldlm_lock2desc);
......
......@@ -876,21 +876,8 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
/* for the local lock, add the reference */
ldlm_lock_addref_internal(lock, einfo->ei_mode);
ldlm_lock2handle(lock, lockh);
if (policy != NULL) {
/* INODEBITS_INTEROP: If the server does not support
* inodebits, we will request a plain lock in the
* descriptor (ldlm_lock2desc() below) but use an
* inodebits lock internally with both bits set.
*/
if (einfo->ei_type == LDLM_IBITS &&
!(exp_connect_flags(exp) &
OBD_CONNECT_IBITS))
lock->l_policy_data.l_inodebits.bits =
MDS_INODELOCK_LOOKUP |
MDS_INODELOCK_UPDATE;
else
if (policy != NULL)
lock->l_policy_data = *policy;
}
if (einfo->ei_type == LDLM_EXTENT)
lock->l_req_extent = policy->l_extent;
......
......@@ -1024,10 +1024,17 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
spin_unlock(&imp->imp_lock);
if (!ocd->ocd_ibits_known &&
ocd->ocd_connect_flags & OBD_CONNECT_IBITS)
CERROR("Inodebits aware server returned zero compatible"
" bits?\n");
if ((imp->imp_connect_flags_orig & OBD_CONNECT_IBITS) &&
!(ocd->ocd_connect_flags & OBD_CONNECT_IBITS)) {
LCONSOLE_WARN("%s: MDS %s does not support ibits "
"lock, either very old or invalid: "
"requested %llx, replied %llx\n",
imp->imp_obd->obd_name,
imp->imp_connection->c_remote_uuid.uuid,
imp->imp_connect_flags_orig,
ocd->ocd_connect_flags);
GOTO(out, rc = -EPROTO);
}
if ((ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
(ocd->ocd_version > LUSTRE_VERSION_CODE +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment