Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217214
b: refs/heads/master
c: f904be9
h: refs/heads/master
v: v3
  • Loading branch information
Bryan Schumaker authored and J. Bruce Fields committed Sep 22, 2010
1 parent d830295 commit ccade9b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 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: e7f483eabea8ef6d2b5ce1b74c8184cc06819f15
refs/heads/master: f904be9cc77f361d37d71468b13ff3d1a1823dea
2 changes: 0 additions & 2 deletions trunk/fs/lockd/svc4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ static void nlm4svc_callback_exit(struct rpc_task *task, void *data)

static void nlm4svc_callback_release(void *data)
{
lock_kernel();
nlm_release_call(data);
unlock_kernel();
}

static const struct rpc_call_ops nlm4svc_callback_ops = {
Expand Down
31 changes: 21 additions & 10 deletions trunk/fs/lockd/svclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ static const struct rpc_call_ops nlmsvc_grant_ops;
* The list of blocked locks to retry
*/
static LIST_HEAD(nlm_blocked);
static DEFINE_SPINLOCK(nlm_blocked_lock);

/*
* Insert a blocked lock into the global list
*/
static void
nlmsvc_insert_block(struct nlm_block *block, unsigned long when)
nlmsvc_insert_block_locked(struct nlm_block *block, unsigned long when)
{
struct nlm_block *b;
struct list_head *pos;
Expand Down Expand Up @@ -87,14 +88,23 @@ nlmsvc_insert_block(struct nlm_block *block, unsigned long when)
block->b_when = when;
}

static void nlmsvc_insert_block(struct nlm_block *block, unsigned long when)
{
spin_lock(&nlm_blocked_lock);
nlmsvc_insert_block_locked(block, when);
spin_unlock(&nlm_blocked_lock);
}

/*
* Remove a block from the global list
*/
static inline void
nlmsvc_remove_block(struct nlm_block *block)
{
if (!list_empty(&block->b_list)) {
spin_lock(&nlm_blocked_lock);
list_del_init(&block->b_list);
spin_unlock(&nlm_blocked_lock);
nlmsvc_release_block(block);
}
}
Expand Down Expand Up @@ -651,7 +661,7 @@ static int nlmsvc_grant_deferred(struct file_lock *fl, struct file_lock *conf,
struct nlm_block *block;
int rc = -ENOENT;

lock_kernel();
spin_lock(&nlm_blocked_lock);
list_for_each_entry(block, &nlm_blocked, b_list) {
if (nlm_compare_locks(&block->b_call->a_args.lock.fl, fl)) {
dprintk("lockd: nlmsvc_notify_blocked block %p flags %d\n",
Expand All @@ -665,13 +675,13 @@ static int nlmsvc_grant_deferred(struct file_lock *fl, struct file_lock *conf,
} else if (result == 0)
block->b_granted = 1;

nlmsvc_insert_block(block, 0);
nlmsvc_insert_block_locked(block, 0);
svc_wake_up(block->b_daemon);
rc = 0;
break;
}
}
unlock_kernel();
spin_unlock(&nlm_blocked_lock);
if (rc == -ENOENT)
printk(KERN_WARNING "lockd: grant for unknown block\n");
return rc;
Expand Down Expand Up @@ -803,7 +813,7 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data)

dprintk("lockd: GRANT_MSG RPC callback\n");

lock_kernel();
spin_lock(&nlm_blocked_lock);
/* if the block is not on a list at this point then it has
* been invalidated. Don't try to requeue it.
*
Expand All @@ -825,19 +835,20 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data)
/* Call was successful, now wait for client callback */
timeout = 60 * HZ;
}
nlmsvc_insert_block(block, timeout);
nlmsvc_insert_block_locked(block, timeout);
svc_wake_up(block->b_daemon);
out:
unlock_kernel();
spin_unlock(&nlm_blocked_lock);
}

/*
* FIXME: nlmsvc_release_block() grabs a mutex. This is not allowed for an
* .rpc_release rpc_call_op
*/
static void nlmsvc_grant_release(void *data)
{
struct nlm_rqst *call = data;

lock_kernel();
nlmsvc_release_block(call->a_block);
unlock_kernel();
}

static const struct rpc_call_ops nlmsvc_grant_ops = {
Expand Down
2 changes: 0 additions & 2 deletions trunk/fs/lockd/svcproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,7 @@ static void nlmsvc_callback_exit(struct rpc_task *task, void *data)

static void nlmsvc_callback_release(void *data)
{
lock_kernel();
nlm_release_call(data);
unlock_kernel();
}

static const struct rpc_call_ops nlmsvc_callback_ops = {
Expand Down

0 comments on commit ccade9b

Please sign in to comment.