[Ocfs2-commits] mfasheh commits r2309 - in trunk/fs/ocfs2: . dlm
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon May 23 19:13:21 CDT 2005
Author: mfasheh
Signed-off-by: zab
Date: 2005-05-23 19:13:19 -0500 (Mon, 23 May 2005)
New Revision: 2309
Modified:
trunk/fs/ocfs2/dlm/userdlm.c
trunk/fs/ocfs2/dlmglue.c
Log:
* print meaningful messages on dlm errors.
Signed-off-by: zab
Modified: trunk/fs/ocfs2/dlm/userdlm.c
===================================================================
--- trunk/fs/ocfs2/dlm/userdlm.c 2005-05-23 23:35:22 UTC (rev 2308)
+++ trunk/fs/ocfs2/dlm/userdlm.c 2005-05-24 00:13:19 UTC (rev 2309)
@@ -102,6 +102,12 @@
spin_unlock(&lockres->l_lock);
}
+#define user_log_dlm_error(_func, _stat, _lockres) do { \
+ mlog(ML_ERROR, "Dlm error \"%s\" while calling %s on " \
+ "resource %s: %s\n", dlm_errname(_stat), _func, \
+ _lockres->l_name, dlm_errmsg(_stat)); \
+} while (0)
+
/* WARNING: This function lives in a world where the only three lock
* levels are EX, PR, and NL. It *will* have to be adjusted when more
* lock types are added. */
@@ -298,7 +304,7 @@
lockres->l_flags &= ~USER_LOCK_IN_CANCEL;
spin_unlock(&lockres->l_lock);
} else if (status != DLM_NORMAL)
- mlog(ML_ERROR, "Dlm returns %d\n", status);
+ user_log_dlm_error("dlmunlock", status, lockres);
goto drop_ref;
}
@@ -339,7 +345,7 @@
lockres,
user_bast);
if (status != DLM_NORMAL) {
- mlog(ML_ERROR, "Dlm returns %d\n", status);
+ user_log_dlm_error("dlmlock", status, lockres);
user_recover_from_dlm_error(lockres);
}
@@ -454,8 +460,8 @@
(status == DLM_NOTQUEUED))
status = -EAGAIN;
else {
- mlog(ML_ERROR, "Dlm returns %d\n", status);
- status = -ENOENT;
+ user_log_dlm_error("dlmlock", status, lockres);
+ status = -EINVAL;
}
user_recover_from_dlm_error(lockres);
goto bail;
@@ -610,7 +616,7 @@
user_unlock_ast,
lockres);
if (status != DLM_NORMAL) {
- mlog(ML_ERROR, "dlm returns %d!\n", status);
+ user_log_dlm_error("dlmunlock", status, lockres);
status = -EINVAL;
goto bail;
}
Modified: trunk/fs/ocfs2/dlmglue.c
===================================================================
--- trunk/fs/ocfs2/dlmglue.c 2005-05-23 23:35:22 UTC (rev 2308)
+++ trunk/fs/ocfs2/dlmglue.c 2005-05-24 00:13:19 UTC (rev 2309)
@@ -187,6 +187,11 @@
ocfs2_lock_res *lockres);
static inline void ocfs2_recover_from_dlm_error(ocfs2_lock_res *lockres,
int convert);
+#define ocfs2_log_dlm_error(_func, _stat, _lockres) do { \
+ mlog(ML_ERROR, "Dlm error \"%s\" while calling %s on " \
+ "resource %s: %s\n", dlm_errname(_stat), _func, \
+ _lockres->l_name, dlm_errmsg(_stat)); \
+} while (0)
static void ocfs2_vote_on_unlock(ocfs_super *osb,
ocfs2_lock_res *lockres);
/* Called after we refresh our inode, only has any effect if we have
@@ -833,9 +838,8 @@
lockres,
lockres->l_ops->bast);
if (status != DLM_NORMAL) {
- mlog(ML_ERROR, "Dlm returns %d for lock %s\n", status,
- lockres->l_name);
- ret = -ENOENT;
+ ocfs2_log_dlm_error("dlmlock", status, lockres);
+ ret = -EINVAL;
ocfs2_recover_from_dlm_error(lockres, 1);
}
@@ -1019,10 +1023,9 @@
(status == DLM_NOTQUEUED))
ret = -EAGAIN;
else {
- mlog(ML_ERROR,
- "Dlm returns %d for lock %s\n",
- status, lockres->l_name);
- ret = -ENOENT;
+ ocfs2_log_dlm_error("dlmlock", status,
+ lockres);
+ ret = -EINVAL;
}
ocfs2_recover_from_dlm_error(lockres, 1);
goto out;
@@ -1793,8 +1796,7 @@
lockres->l_ops->unlock_ast,
lockres);
if (status != DLM_NORMAL) {
- mlog(ML_ERROR, "Dlm returns %d for lock %s\n", status,
- lockres->l_name);
+ ocfs2_log_dlm_error("dlmunlock", status, lockres);
dlm_print_one_lock(lockres->l_lksb.lockid);
BUG();
}
@@ -1937,9 +1939,8 @@
lockres,
lockres->l_ops->bast);
if (status != DLM_NORMAL) {
- mlog(ML_ERROR, "Dlm returns %d for lock %s\n", status,
- lockres->l_name);
- ret = -ENOENT;
+ ocfs2_log_dlm_error("dlmlock", status, lockres);
+ ret = -EINVAL;
ocfs2_recover_from_dlm_error(lockres, 1);
goto bail;
}
@@ -1986,9 +1987,8 @@
lockres->l_unlock_action = OCFS2_UNLOCK_INVALID;
spin_unlock(&lockres->l_lock);
} else if (status != DLM_NORMAL) {
- mlog(ML_ERROR, "Dlm returns %d for lock %s\n", status,
- lockres->l_name);
- ret = -ENOENT;
+ ocfs2_log_dlm_error("dlmunlock", status, lockres);
+ ret = -EINVAL;
ocfs2_recover_from_dlm_error(lockres, 0);
}
More information about the Ocfs2-commits
mailing list