All of lore.kernel.org
 help / color / mirror / Atom feed
From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/dlm-kernel/src locking.c
Date: 7 Jul 2006 15:24:48 -0000	[thread overview]
Message-ID: <20060707152448.3489.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	STABLE
Changes by:	teigland at sourceware.org	2006-07-07 15:24:47

Modified files:
	dlm-kernel/src : locking.c 

Log message:
	add printk's for the error conditions so we have some idea
	what happened before a gfs panic

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm-kernel/src/locking.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.50.2.8&r2=1.50.2.8.6.1

--- cluster/dlm-kernel/src/Attic/locking.c	2005/03/10 07:07:36	1.50.2.8
+++ cluster/dlm-kernel/src/Attic/locking.c	2006/07/07 15:24:47	1.50.2.8.6.1
@@ -396,56 +396,85 @@
 	     void (*bast) (void *astarg, int mode),
 	     struct dlm_range *range)
 {
-	struct dlm_ls *lspace;
+	struct dlm_ls *ls;
 	struct dlm_lkb *lkb = NULL, *parent_lkb = NULL;
 	int ret = -EINVAL;
 
-	lspace = find_lockspace_by_local_id(lockspace);
-	if (!lspace)
+	ls = find_lockspace_by_local_id(lockspace);
+	if (!ls) {
+		log_print("dlm_lock: no lockspace");
 		return ret;
+	}
 
-	if (mode < 0 || mode > DLM_LOCK_EX)
+	if (mode < 0 || mode > DLM_LOCK_EX) {
+		log_error(ls, "dlm_lock: bad mode %u", mode);
 		goto out;
+	}
 
-	if (!(flags & DLM_LKF_CONVERT) && (namelen > DLM_RESNAME_MAXLEN))
+	if (!(flags & DLM_LKF_CONVERT) && (namelen > DLM_RESNAME_MAXLEN)) {
+		log_error(ls, "dlm_lock: bad name length %u", namelen);
 		goto out;
+	}
 
-	if (flags & DLM_LKF_CANCEL)
+	if (flags & DLM_LKF_CANCEL) {
+		log_error(ls, "dlm_lock: cancel not allowed");
 		goto out;
+	}
 
-	if (flags & DLM_LKF_QUECVT && !(flags & DLM_LKF_CONVERT))
+	if (flags & DLM_LKF_QUECVT && !(flags & DLM_LKF_CONVERT)) {
+		log_error(ls, "dlm_lock: bad quecvt use %x", flags);
 		goto out;
+	}
 
-	if (flags & DLM_LKF_CONVDEADLK && !(flags & DLM_LKF_CONVERT))
+	if (flags & DLM_LKF_CONVDEADLK && !(flags & DLM_LKF_CONVERT)) {
+		log_error(ls, "dlm_lock: bad convdeadlk/convert use %x", flags);
 		goto out;
+	}
 
-	if (flags & DLM_LKF_CONVDEADLK && flags & DLM_LKF_NOQUEUE)
+	if (flags & DLM_LKF_CONVDEADLK && flags & DLM_LKF_NOQUEUE) {
+		log_error(ls, "dlm_lock: bad convdeadlk/noqueue use %x", flags);
 		goto out;
+	}
 
-	if (flags & DLM_LKF_EXPEDITE && flags & DLM_LKF_CONVERT)
+	if (flags & DLM_LKF_EXPEDITE && flags & DLM_LKF_CONVERT) {
+		log_error(ls, "dlm_lock: bad expedite/convert use %x", flags);
 		goto out;
+	}
 
-	if (flags & DLM_LKF_EXPEDITE && flags & DLM_LKF_QUECVT)
+	if (flags & DLM_LKF_EXPEDITE && flags & DLM_LKF_QUECVT) {
+		log_error(ls, "dlm_lock: bad expedite/quecvt use %x", flags);
 		goto out;
+	}
 
-	if (flags & DLM_LKF_EXPEDITE && flags & DLM_LKF_NOQUEUE)
+	if (flags & DLM_LKF_EXPEDITE && flags & DLM_LKF_NOQUEUE) {
+		log_error(ls, "dlm_lock: bad expedite/noqueue use %x", flags);
 		goto out;
+	}
 
-	if (flags & DLM_LKF_EXPEDITE && (mode != DLM_LOCK_NL))
+	if (flags & DLM_LKF_EXPEDITE && (mode != DLM_LOCK_NL)) {
+		log_error(ls, "dlm_lock: bad mode %u flags %x", mode, flags);
 		goto out;
+	}
 
-	if (!ast || !lksb)
+	if (!ast || !lksb) {
+		if (!ast)
+			log_error(ls, "dlm_lock: no ast param");
+		if (!lksb)
+			log_error(ls, "dlm_lock: no lksb param");
 		goto out;
+	}
 
-	if ((flags & DLM_LKF_VALBLK) && !lksb->sb_lvbptr)
+	if ((flags & DLM_LKF_VALBLK) && !lksb->sb_lvbptr) {
+		log_error(ls, "dlm_lock: no lvbptr flags %x", flags);
 		goto out;
+	}
 
 	/*
 	 * Take conversion path.
 	 */
 
 	if (flags & DLM_LKF_CONVERT) {
-		ret = convert_lock(lspace, mode, lksb, flags, ast, astarg,
+		ret = convert_lock(ls, mode, lksb, flags, ast, astarg,
 				   bast, range);
 		goto out;
 	}
@@ -458,27 +487,27 @@
 	 */
 
 	if (parent) {
-		down_read(&lspace->ls_unlock_sem);
+		down_read(&ls->ls_unlock_sem);
 
-		parent_lkb = find_lock_by_id(lspace, parent);
+		parent_lkb = find_lock_by_id(ls, parent);
 
 		if (!parent_lkb ||
 		    parent_lkb->lkb_flags & GDLM_LKFLG_DELETED ||
 		    parent_lkb->lkb_flags & GDLM_LKFLG_MSTCPY ||
 		    parent_lkb->lkb_status != GDLM_LKSTS_GRANTED) {
-			up_read(&lspace->ls_unlock_sem);
+			up_read(&ls->ls_unlock_sem);
 			goto out;
 		}
 
 		atomic_inc(&parent_lkb->lkb_childcnt);
-		up_read(&lspace->ls_unlock_sem);
+		up_read(&ls->ls_unlock_sem);
 	}
 
-	down_read(&lspace->ls_in_recovery);
+	down_read(&ls->ls_in_recovery);
 
 	ret = -ENOMEM;
 
-	lkb = create_lkb(lspace);
+	lkb = create_lkb(ls);
 	if (!lkb)
 		goto fail_dec;
 	lkb->lkb_astaddr = ast;
@@ -499,11 +528,12 @@
 
 	if (range) {
 		if (range->ra_start > range->ra_end) {
+			log_error(ls, "dlm_lock bad range");
 			ret = -EINVAL;
 			goto fail_free;
 		}
 
-		if (lkb_set_range(lspace, lkb, range->ra_start, range->ra_end))
+		if (lkb_set_range(ls, lkb, range->ra_start, range->ra_end))
 			goto fail_free;
 	}
 
@@ -517,19 +547,19 @@
 
 	lksb->sb_lkid = lkb->lkb_id;
 
-	ret = dlm_lock_stage1(lspace, lkb, flags, name, namelen);
+	ret = dlm_lock_stage1(ls, lkb, flags, name, namelen);
 	if (ret)
 		goto fail_free;
 
-	up_read(&lspace->ls_in_recovery);
+	up_read(&ls->ls_in_recovery);
 
 	wake_astd();
 
-	put_lockspace(lspace);
+	put_lockspace(ls);
 	return 0;
 
       fail_free:
-	release_lkb(lspace, lkb);
+	release_lkb(ls, lkb);
 	goto fail_unlock;
 
       fail_dec:
@@ -537,10 +567,10 @@
 		atomic_dec(&parent_lkb->lkb_childcnt);
 
       fail_unlock:
-	up_read(&lspace->ls_in_recovery);
+	up_read(&ls->ls_in_recovery);
 
       out:
-	put_lockspace(lspace);
+	put_lockspace(ls);
 	return ret;
 }
 
@@ -805,20 +835,20 @@
 
 	lkb = find_lock_by_id(ls, lkid);
 	if (!lkb) {
-		log_debug(ls, "unlock %x no id", lkid);
+		log_error(ls, "dlm_unlock: unknown lkid %x", lkid);
 		goto out;
 	}
 
 	/* Can't dequeue a master copy (a remote node's mastered lock) */
 	if (lkb->lkb_flags & GDLM_LKFLG_MSTCPY) {
-		log_debug(ls, "(%d) unlock %x lkb_flags %x",
+		log_error(ls, "(%d) dlm_unlock: %x invalid lkb_flags %x",
 			  lkb->lkb_ownpid, lkid, lkb->lkb_flags);
 		goto out;
 	}
 
 	/* Already waiting for a remote lock operation */
 	if (lkb->lkb_lockqueue_state) {
-		log_debug(ls, "(%d) unlock %x lq%d",
+		log_error(ls, "(%d) dlm_unlock: %x busy %d",
 			  lkb->lkb_ownpid, lkid, lkb->lkb_lockqueue_state);
 		ret = -EBUSY;
 		goto out;
@@ -833,7 +863,7 @@
 	 */
 	if ((flags & DLM_LKF_CANCEL) &&
 	    (lkb->lkb_status == GDLM_LKSTS_GRANTED)) {
-		log_debug(ls, "(%d) unlock %x %x %d",
+		log_error(ls, "(%d) dlm_unlock: id %x flags %x status %d",
 			  lkb->lkb_ownpid, lkid, flags, lkb->lkb_status);
 		goto out;
 	}
@@ -841,13 +871,13 @@
 	/* "Normal" unlocks must operate on a granted lock */
 	if (!(flags & DLM_LKF_CANCEL) &&
 	    (lkb->lkb_status != GDLM_LKSTS_GRANTED)) {
-		log_debug(ls, "(%d) unlock %x %x %d",
+		log_error(ls, "(%d) dlm_unlock: id %x flags %x status %d",
 			  lkb->lkb_ownpid, lkid, flags, lkb->lkb_status);
 		goto out;
 	}
 
 	if (lkb->lkb_flags & GDLM_LKFLG_DELETED) {
-		log_debug(ls, "(%d) unlock deleted %x %x %d",
+		log_debug(ls, "(%d) dlm_unlock: deleted id %x flags %x sts %d",
 			  lkb->lkb_ownpid, lkid, flags, lkb->lkb_status);
 		goto out;
 	}
@@ -1005,24 +1035,34 @@
 
 	lkb = find_lock_by_id(ls, lksb->sb_lkid);
 	if (!lkb) {
+		log_error(ls, "dlm_lock: convert unknown lkid %x",
+			  lksb->sb_lkid);
 		goto out;
 	}
 
 	if (lkb->lkb_status != GDLM_LKSTS_GRANTED) {
+		log_error(ls, "dlm_lock: convert busy lock id %x status %d",
+			  lksb->sb_lkid, lkb->lkb_status);
 		ret = -EBUSY;
 		goto out;
 	}
 
 	if (lkb->lkb_flags & GDLM_LKFLG_MSTCPY) {
+		log_error(ls, "dlm_lock: convert mstcpy flags %x id %x",
+			  lkb->lkb_flags, lksb->sb_lkid);
 		goto out;
 	}
 
 	if ((flags & DLM_LKF_QUECVT) &&
 	    !__quecvt_compat_matrix[lkb->lkb_grmode + 1][mode + 1]) {
+		log_error(ls, "dlm_lock: convert id %x flags %x modes %d %d",
+			  lksb->sb_lkid, flags, lkb->lkb_grmode, mode);
 		goto out;
 	}
 
 	if (!lksb->sb_lvbptr && (flags & DLM_LKF_VALBLK)) {
+		log_error(ls, "dlm_lock: convert %x no lvbptr %x",
+			  lksb->sb_lkid, flags);
 	        goto out;
 	}
 
@@ -1031,8 +1071,10 @@
 #endif
 	/* Set up the ranges as appropriate */
 	if (range) {
-		if (range->ra_start > range->ra_end)
+		if (range->ra_start > range->ra_end) {
+			log_error(ls, "dlm_lock: convert bad range");
 			goto out;
+		}
 
 		if (lkb_set_range(ls, lkb, range->ra_start, range->ra_end)) {
 			ret = -ENOMEM;



             reply	other threads:[~2006-07-07 15:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07 15:24 teigland [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-08-14 17:14 [Cluster-devel] cluster/dlm-kernel/src locking.c teigland
2006-06-22 14:29 teigland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060707152448.3489.qmail@sourceware.org \
    --to=teigland@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.