Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23892
b: refs/heads/master
c: a85f193
h: refs/heads/master
v: v3
  • Loading branch information
Andy Adamson authored and Trond Myklebust committed Mar 20, 2006
1 parent 1210005 commit 42f306a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 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: 5de0e5024a4e21251fd80dbfdb83316ce97086bc
refs/heads/master: a85f193e2fb7d53e48ae6a9d9ea990bfb4cea555
23 changes: 4 additions & 19 deletions trunk/fs/lockd/svclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ u32
nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
struct nlm_lock *lock, int wait, struct nlm_cookie *cookie)
{
struct file_lock *conflock;
struct nlm_block *block;
int error;
u32 ret;
Expand All @@ -320,24 +319,22 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
/* Lock file against concurrent access */
down(&file->f_sema);

if (!(conflock = posix_test_lock(file->f_file, &lock->fl))) {
error = posix_lock_file(file->f_file, &lock->fl);
error = posix_lock_file(file->f_file, &lock->fl);

dprintk("lockd: posix_lock_file returned %d\n", error);

if (error != -EAGAIN) {
if (block)
nlmsvc_delete_block(block, 0);
up(&file->f_sema);

dprintk("lockd: posix_lock_file returned %d\n", -error);
switch(-error) {
case 0:
ret = nlm_granted;
goto out;
case EDEADLK:
ret = nlm_deadlock;
goto out;
case EAGAIN:
ret = nlm_lck_denied;
goto out;
default: /* includes ENOLCK */
ret = nlm_lck_denied_nolocks;
goto out;
Expand All @@ -349,11 +346,6 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
goto out_unlock;
}

if (posix_locks_deadlock(&lock->fl, conflock)) {
ret = nlm_deadlock;
goto out_unlock;
}

/* If we don't have a block, create and initialize it. Then
* retry because we may have slept in kmalloc. */
/* We have to release f_sema as nlmsvc_create_block may try to
Expand All @@ -369,13 +361,6 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
/* Append to list of blocked */
nlmsvc_insert_block(block, NLM_NEVER);

if (list_empty(&block->b_call.a_args.lock.fl.fl_block)) {
/* Now add block to block list of the conflicting lock
if we haven't done so. */
dprintk("lockd: blocking on this lock.\n");
posix_block_lock(conflock, &block->b_call.a_args.lock.fl);
}

ret = nlm_lck_blocked;
out_unlock:
up(&file->f_sema);
Expand Down

0 comments on commit 42f306a

Please sign in to comment.