aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-07-10 12:25:39 -0400
committerMark Fasheh <mfasheh@suse.com>2008-07-10 12:25:39 -0400
commite988cf1cfed4ed80bf40528e655fe18bed6a38b6 (patch)
treeeeaf62bcf6e9f9b3154b70bf98e70881234f7ccc
parent6329d3021bcfa9038621e6e917d98929421d8ec8 (diff)
ocfs2: Fix flags in ocfs2_file_lock
The stack-glue merge changed the way we use flags in dlmglue in that we now use the fs/dlm equivalents. Unfortunately, a merge error left the new flock code only partially updated. This took a while to show up though, because the lock level constants are actually identical between o2dlm and fs/dlm. The *_CONVERT and *_NOQUEUE flags have different values though, which is eventually causing a crash in flags_to_o2dlm(). Signed-off-by: Mark Fasheh <mfasheh@suse.com>
-rw-r--r--fs/ocfs2/dlmglue.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 394d25a131a5..80e20d9f2780 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -1554,8 +1554,8 @@ out:
1554 */ 1554 */
1555int ocfs2_file_lock(struct file *file, int ex, int trylock) 1555int ocfs2_file_lock(struct file *file, int ex, int trylock)
1556{ 1556{
1557 int ret, level = ex ? LKM_EXMODE : LKM_PRMODE; 1557 int ret, level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
1558 unsigned int lkm_flags = trylock ? LKM_NOQUEUE : 0; 1558 unsigned int lkm_flags = trylock ? DLM_LKF_NOQUEUE : 0;
1559 unsigned long flags; 1559 unsigned long flags;
1560 struct ocfs2_file_private *fp = file->private_data; 1560 struct ocfs2_file_private *fp = file->private_data;
1561 struct ocfs2_lock_res *lockres = &fp->fp_flock; 1561 struct ocfs2_lock_res *lockres = &fp->fp_flock;
@@ -1582,7 +1582,7 @@ int ocfs2_file_lock(struct file *file, int ex, int trylock)
1582 * Get the lock at NLMODE to start - that way we 1582 * Get the lock at NLMODE to start - that way we
1583 * can cancel the upconvert request if need be. 1583 * can cancel the upconvert request if need be.
1584 */ 1584 */
1585 ret = ocfs2_lock_create(osb, lockres, LKM_NLMODE, 0); 1585 ret = ocfs2_lock_create(osb, lockres, DLM_LOCK_NL, 0);
1586 if (ret < 0) { 1586 if (ret < 0) {
1587 mlog_errno(ret); 1587 mlog_errno(ret);
1588 goto out; 1588 goto out;
@@ -1597,7 +1597,7 @@ int ocfs2_file_lock(struct file *file, int ex, int trylock)
1597 } 1597 }
1598 1598
1599 lockres->l_action = OCFS2_AST_CONVERT; 1599 lockres->l_action = OCFS2_AST_CONVERT;
1600 lkm_flags |= LKM_CONVERT; 1600 lkm_flags |= DLM_LKF_CONVERT;
1601 lockres->l_requested = level; 1601 lockres->l_requested = level;
1602 lockres_or_flags(lockres, OCFS2_LOCK_BUSY); 1602 lockres_or_flags(lockres, OCFS2_LOCK_BUSY);
1603 1603
@@ -1664,7 +1664,7 @@ void ocfs2_file_unlock(struct file *file)
1664 if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) 1664 if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED))
1665 return; 1665 return;
1666 1666
1667 if (lockres->l_level == LKM_NLMODE) 1667 if (lockres->l_level == DLM_LOCK_NL)
1668 return; 1668 return;
1669 1669
1670 mlog(0, "Unlock: \"%s\" flags: 0x%lx, level: %d, act: %d\n", 1670 mlog(0, "Unlock: \"%s\" flags: 0x%lx, level: %d, act: %d\n",
@@ -1678,11 +1678,11 @@ void ocfs2_file_unlock(struct file *file)
1678 lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED); 1678 lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED);
1679 lockres->l_blocking = DLM_LOCK_EX; 1679 lockres->l_blocking = DLM_LOCK_EX;
1680 1680
1681 gen = ocfs2_prepare_downconvert(lockres, LKM_NLMODE); 1681 gen = ocfs2_prepare_downconvert(lockres, DLM_LOCK_NL);
1682 lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_BUSY, 0); 1682 lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_BUSY, 0);
1683 spin_unlock_irqrestore(&lockres->l_lock, flags); 1683 spin_unlock_irqrestore(&lockres->l_lock, flags);
1684 1684
1685 ret = ocfs2_downconvert_lock(osb, lockres, LKM_NLMODE, 0, gen); 1685 ret = ocfs2_downconvert_lock(osb, lockres, DLM_LOCK_NL, 0, gen);
1686 if (ret) { 1686 if (ret) {
1687 mlog_errno(ret); 1687 mlog_errno(ret);
1688 return; 1688 return;