Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35501
b: refs/heads/master
c: 16d5b95
h: refs/heads/master
i:
  35499: 01cf8fd
v: v3
  • Loading branch information
Mark Fasheh committed Sep 24, 2006
1 parent 67d55cf commit 65b94e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f7fbfdd1fc91543253ba742a926a29c289f8e6ca
refs/heads/master: 16d5b9567ad5241b5c6e0cc4778c1af6c04bb801
19 changes: 18 additions & 1 deletion trunk/fs/ocfs2/dlmglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ struct ocfs2_lock_res_ops {
int (*unblock)(struct ocfs2_lock_res *, struct ocfs2_unblock_ctl *);
void (*post_unlock)(struct ocfs2_super *, struct ocfs2_lock_res *);

/*
* Allow a lock type to add checks to determine whether it is
* safe to downconvert a lock. Return 0 to re-queue the
* downconvert at a later time, nonzero to continue.
*
* For most locks, the default checks that there are no
* incompatible holders are sufficient.
*
* Called with the lockres spinlock held.
*/
int (*check_downconvert)(struct ocfs2_lock_res *, int);

/*
* LOCK_TYPE_* flags which describe the specific requirements
* of a lock type. Descriptions of each individual flag follow.
Expand Down Expand Up @@ -2657,6 +2669,12 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
&& (lockres->l_flags & OCFS2_LOCK_REFRESHING))
goto leave_requeue;

new_level = ocfs2_highest_compat_lock_level(lockres->l_blocking);

if (lockres->l_ops->check_downconvert
&& !lockres->l_ops->check_downconvert(lockres, new_level))
goto leave_requeue;

/* If we get here, then we know that there are no more
* incompatible holders (and anyone asking for an incompatible
* lock is blocked). We can now downconvert the lock */
Expand Down Expand Up @@ -2684,7 +2702,6 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,

downconvert:
ctl->requeue = 0;
new_level = ocfs2_highest_compat_lock_level(lockres->l_blocking);

ocfs2_prepare_downconvert(lockres, new_level);
spin_unlock_irqrestore(&lockres->l_lock, flags);
Expand Down

0 comments on commit 65b94e1

Please sign in to comment.