[Ocfs2-commits] mfasheh commits r2496 - trunk/fs/ocfs2/dlm
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Aug 3 20:12:17 CDT 2005
Author: mfasheh
Signed-off-by: jlbec
Date: 2005-08-03 20:12:16 -0500 (Wed, 03 Aug 2005)
New Revision: 2496
Modified:
trunk/fs/ocfs2/dlm/dlmapi.h
trunk/fs/ocfs2/dlm/dlmast.c
trunk/fs/ocfs2/dlm/dlmconvert.c
trunk/fs/ocfs2/dlm/dlmlock.c
trunk/fs/ocfs2/dlm/dlmunlock.c
Log:
* better error reporting in the dlm. This should help us track dlm
issues more easily.
Signed-off-by: jlbec
Modified: trunk/fs/ocfs2/dlm/dlmapi.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmapi.h 2005-08-03 02:51:10 UTC (rev 2495)
+++ trunk/fs/ocfs2/dlm/dlmapi.h 2005-08-04 01:12:16 UTC (rev 2496)
@@ -84,8 +84,17 @@
/* for pretty-printing dlm_status error names */
const char *dlm_errname(enum dlm_status err);
+/* Eventually the DLM will use standard errno values, but in the
+ * meantime this lets us track dlm errors as they bubble up. When we
+ * bring its error reporting into line with the rest of the stack,
+ * these can just be replaced with calls to mlog_errno. */
+#define dlm_error(st) do { \
+ if ((st) != DLM_RECOVERING && \
+ (st) != DLM_MIGRATING && \
+ (st) != DLM_FORWARD) \
+ mlog(ML_ERROR, "dlm status = %s\n", dlm_errname((st))); \
+} while (0)
-
#define DLM_LKSB_UNUSED1 0x01
#define DLM_LKSB_PUT_LVB 0x02
#define DLM_LKSB_GET_LVB 0x04
Modified: trunk/fs/ocfs2/dlm/dlmast.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmast.c 2005-08-03 02:51:10 UTC (rev 2495)
+++ trunk/fs/ocfs2/dlm/dlmast.c 2005-08-04 01:12:16 UTC (rev 2496)
@@ -256,8 +256,10 @@
u64 cookie;
u32 flags;
- if (!dlm_grab(dlm))
+ if (!dlm_grab(dlm)) {
+ dlm_error(DLM_REJECTED);
return DLM_REJECTED;
+ }
mlog_bug_on_msg(!dlm_domain_fully_joined(dlm),
"Domain %s not fully joined!\n", dlm->name);
Modified: trunk/fs/ocfs2/dlm/dlmconvert.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmconvert.c 2005-08-03 02:51:10 UTC (rev 2495)
+++ trunk/fs/ocfs2/dlm/dlmconvert.c 2005-08-04 01:12:16 UTC (rev 2496)
@@ -94,6 +94,8 @@
res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
spin_unlock(&res->spinlock);
wake_up(&res->wq);
+ if (status != DLM_NORMAL && status != DLM_NOTQUEUED)
+ dlm_error(status);
/* either queue the ast or release it */
if (call_ast)
@@ -315,8 +317,11 @@
res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
lock->convert_pending = 0;
/* if it failed, move it back to granted queue */
- if (status != DLM_NORMAL)
+ if (status != DLM_NORMAL) {
+ if (status != DLM_NOTQUEUED)
+ dlm_error(status);
dlm_revert_pending_convert(res, lock);
+ }
bail:
spin_unlock(&res->spinlock);
@@ -380,7 +385,8 @@
} else if (ret == DLM_FORWARD) {
mlog(0, "node %u returned DLM_FORWARD from convert "
"message!\n", res->owner);
- }
+ } else if (ret != DLM_NORMAL)
+ dlm_error(ret);
} else {
mlog_errno(tmpret);
if (dlm_is_host_down(tmpret)) {
@@ -416,8 +422,10 @@
u32 flags;
int call_ast = 0, kick_thread = 0;
- if (!dlm_grab(dlm))
+ if (!dlm_grab(dlm)) {
+ dlm_error(DLM_REJECTED);
return DLM_REJECTED;
+ }
mlog_bug_on_msg(!dlm_domain_fully_joined(dlm),
"Domain %s not fully joined!\n", dlm->name);
@@ -426,6 +434,7 @@
if (cnv->namelen > DLM_LOCKID_NAME_MAX) {
status = DLM_IVBUFLEN;
+ dlm_error(status);
goto leave;
}
@@ -443,8 +452,10 @@
status = DLM_IVLOCKID;
res = dlm_lookup_lockres(dlm, cnv->name, cnv->namelen);
- if (!res)
+ if (!res) {
+ dlm_error(status);
goto leave;
+ }
spin_lock(&res->spinlock);
list_for_each(iter, &res->granted) {
@@ -457,8 +468,11 @@
lock = NULL;
}
spin_unlock(&res->spinlock);
- if (!lock)
+ if (!lock) {
+ status = DLM_IVLOCKID;
+ dlm_error(status);
goto leave;
+ }
/* found the lock */
lksb = lock->lksb;
@@ -485,9 +499,11 @@
}
spin_unlock(&res->spinlock);
-
- if (status != DLM_NORMAL)
+ if (status != DLM_NORMAL) {
+ if (status != DLM_NOTQUEUED)
+ dlm_error(status);
lksb->flags &= ~(DLM_LKSB_GET_LVB|DLM_LKSB_PUT_LVB);
+ }
leave:
if (!lock)
Modified: trunk/fs/ocfs2/dlm/dlmlock.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmlock.c 2005-08-03 02:51:10 UTC (rev 2495)
+++ trunk/fs/ocfs2/dlm/dlmlock.c 2005-08-04 01:12:16 UTC (rev 2496)
@@ -117,6 +117,7 @@
lock->ml.node != dlm->node_num) {
/* erf. state changed after lock was dropped. */
spin_unlock(&res->spinlock);
+ dlm_error(status);
return status;
}
__dlm_wait_on_lockres(res);
@@ -214,6 +215,7 @@
res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
lock->lock_pending = 0;
if (status != DLM_NORMAL) {
+ dlm_error(status);
dlm_revert_pending_lock(res, lock);
dlm_lock_put(lock);
}
@@ -413,15 +415,19 @@
namelen = create->namelen;
status = DLM_IVBUFLEN;
- if (namelen > DLM_LOCKID_NAME_MAX)
+ if (namelen > DLM_LOCKID_NAME_MAX) {
+ dlm_error(status);
goto leave;
+ }
status = DLM_SYSERR;
newlock = dlm_new_lock(create->requested_type,
create->node_idx,
create->cookie, NULL);
- if (!newlock)
+ if (!newlock) {
+ dlm_error(status);
goto leave;
+ }
lksb = newlock->lksb;
@@ -432,8 +438,10 @@
status = DLM_IVLOCKID;
res = dlm_lookup_lockres(dlm, name, namelen);
- if (!res)
+ if (!res) {
+ dlm_error(status);
goto leave;
+ }
spin_lock(&res->spinlock);
status = __dlm_lockres_state_to_status(res);
@@ -491,21 +499,28 @@
/* yes this function is a mess.
* TODO: clean this up. lots of common code in the
* lock and convert paths, especially in the retry blocks */
- if (!lksb)
+ if (!lksb) {
+ dlm_error(DLM_BADARGS);
return DLM_BADARGS;
+ }
status = DLM_BADPARAM;
- if (mode != LKM_EXMODE && mode != LKM_PRMODE && mode != LKM_NLMODE)
+ if (mode != LKM_EXMODE && mode != LKM_PRMODE && mode != LKM_NLMODE) {
+ dlm_error(status);
goto error;
+ }
- if (flags & ~LKM_VALID_FLAGS)
+ if (flags & ~LKM_VALID_FLAGS) {
+ dlm_error(status);
goto error;
+ }
convert = (flags & LKM_CONVERT);
recovery = (flags & LKM_RECOVERY);
if (recovery &&
(!dlm_is_recovery_lock(name, strlen(name)) || convert) ) {
+ dlm_error(status);
goto error;
}
if (convert && (flags & LKM_LOCAL)) {
@@ -570,17 +585,23 @@
/* LOCK request */
status = DLM_BADARGS;
- if (!name)
+ if (!name) {
+ dlm_error(status);
goto error;
+ }
status = DLM_IVBUFLEN;
- if (strlen(name) > DLM_LOCKID_NAME_MAX || strlen(name) < 1)
+ if (strlen(name) > DLM_LOCKID_NAME_MAX || strlen(name) < 1) {
+ dlm_error(status);
goto error;
+ }
dlm_get_next_cookie(dlm->node_num, &tmpcookie);
lock = dlm_new_lock(mode, dlm->node_num, tmpcookie, lksb);
- if (!lock)
+ if (!lock) {
+ dlm_error(status);
goto error;
+ }
if (!recovery)
dlm_wait_for_recovery(dlm);
@@ -589,6 +610,7 @@
res = dlm_get_lock_resource(dlm, name, flags);
if (!res) {
status = DLM_IVLOCKID;
+ dlm_error(status);
goto error;
}
@@ -630,6 +652,7 @@
if (status != DLM_NORMAL) {
lock->lksb->flags &= ~DLM_LKSB_GET_LVB;
+ dlm_error(status);
goto error;
}
}
Modified: trunk/fs/ocfs2/dlm/dlmunlock.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmunlock.c 2005-08-03 02:51:10 UTC (rev 2495)
+++ trunk/fs/ocfs2/dlm/dlmunlock.c 2005-08-04 01:12:16 UTC (rev 2496)
@@ -548,6 +548,7 @@
if (!dlm_lock_on_list(&res->granted, lock)) {
lksb->status = DLM_DENIED;
status = DLM_DENIED;
+ dlm_error(status);
*actions = 0;
} else {
/* unlock granted lock */
@@ -574,19 +575,25 @@
mlog_entry_void();
- if (!lksb)
+ if (!lksb) {
+ dlm_error(DLM_BADARGS);
return DLM_BADARGS;
+ }
- if (flags & ~(LKM_CANCEL | LKM_VALBLK | LKM_INVVALBLK))
+ if (flags & ~(LKM_CANCEL | LKM_VALBLK | LKM_INVVALBLK)) {
+ dlm_error(DLM_BADPARAM);
return DLM_BADPARAM;
+ }
if ((flags & (LKM_VALBLK | LKM_CANCEL)) == (LKM_VALBLK | LKM_CANCEL)) {
mlog(0, "VALBLK given with CANCEL: ignoring VALBLK\n");
flags &= ~LKM_VALBLK;
}
- if (!lksb->lockid || !lksb->lockid->lockres)
+ if (!lksb->lockid || !lksb->lockid->lockres) {
+ dlm_error(DLM_BADPARAM);
return DLM_BADPARAM;
+ }
lock = lksb->lockid;
BUG_ON(!lock);
@@ -653,7 +660,8 @@
if (status == DLM_NORMAL) {
mlog(0, "kicking the thread\n");
dlm_kick_thread(dlm, res);
- }
+ } else
+ dlm_error(status);
dlm_lockres_calc_usage(dlm, res);
dlm_lockres_put(res);
More information about the Ocfs2-commits
mailing list