Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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-4971


Reviewed-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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+6 −44
Original line number Diff line number Diff line
@@ -613,43 +613,6 @@ 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;
@@ -657,7 +620,6 @@ void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc)
				    &lock->l_policy_data,
				    &desc->l_policy_data);
}
}
EXPORT_SYMBOL(ldlm_lock2desc);

/**
+1 −14
Original line number Diff line number Diff line
@@ -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;
+11 −4
Original line number Diff line number Diff line
@@ -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 +