diff options
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/clntproc.c | 10 | ||||
-rw-r--r-- | fs/lockd/svclock.c | 13 |
2 files changed, 13 insertions, 10 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 1f6dc518505c..31668b690e03 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -582,7 +582,15 @@ again: | |||
582 | } | 582 | } |
583 | if (status < 0) | 583 | if (status < 0) |
584 | goto out_unlock; | 584 | goto out_unlock; |
585 | status = nlm_stat_to_errno(resp->status); | 585 | /* |
586 | * EAGAIN doesn't make sense for sleeping locks, and in some | ||
587 | * cases NLM_LCK_DENIED is returned for a permanent error. So | ||
588 | * turn it into an ENOLCK. | ||
589 | */ | ||
590 | if (resp->status == nlm_lck_denied && (fl_flags & FL_SLEEP)) | ||
591 | status = -ENOLCK; | ||
592 | else | ||
593 | status = nlm_stat_to_errno(resp->status); | ||
586 | out_unblock: | 594 | out_unblock: |
587 | nlmclnt_finish_block(block); | 595 | nlmclnt_finish_block(block); |
588 | out: | 596 | out: |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 821b9acdfb66..cf0d5c2c318d 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -418,8 +418,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
418 | goto out; | 418 | goto out; |
419 | case -EAGAIN: | 419 | case -EAGAIN: |
420 | ret = nlm_lck_denied; | 420 | ret = nlm_lck_denied; |
421 | break; | 421 | goto out; |
422 | case -EINPROGRESS: | 422 | case FILE_LOCK_DEFERRED: |
423 | if (wait) | 423 | if (wait) |
424 | break; | 424 | break; |
425 | /* Filesystem lock operation is in progress | 425 | /* Filesystem lock operation is in progress |
@@ -434,10 +434,6 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
434 | goto out; | 434 | goto out; |
435 | } | 435 | } |
436 | 436 | ||
437 | ret = nlm_lck_denied; | ||
438 | if (!wait) | ||
439 | goto out; | ||
440 | |||
441 | ret = nlm_lck_blocked; | 437 | ret = nlm_lck_blocked; |
442 | 438 | ||
443 | /* Append to list of blocked */ | 439 | /* Append to list of blocked */ |
@@ -507,7 +503,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
507 | } | 503 | } |
508 | 504 | ||
509 | error = vfs_test_lock(file->f_file, &lock->fl); | 505 | error = vfs_test_lock(file->f_file, &lock->fl); |
510 | if (error == -EINPROGRESS) { | 506 | if (error == FILE_LOCK_DEFERRED) { |
511 | ret = nlmsvc_defer_lock_rqst(rqstp, block); | 507 | ret = nlmsvc_defer_lock_rqst(rqstp, block); |
512 | goto out; | 508 | goto out; |
513 | } | 509 | } |
@@ -731,8 +727,7 @@ nlmsvc_grant_blocked(struct nlm_block *block) | |||
731 | switch (error) { | 727 | switch (error) { |
732 | case 0: | 728 | case 0: |
733 | break; | 729 | break; |
734 | case -EAGAIN: | 730 | case FILE_LOCK_DEFERRED: |
735 | case -EINPROGRESS: | ||
736 | dprintk("lockd: lock still blocked error %d\n", error); | 731 | dprintk("lockd: lock still blocked error %d\n", error); |
737 | nlmsvc_insert_block(block, NLM_NEVER); | 732 | nlmsvc_insert_block(block, NLM_NEVER); |
738 | nlmsvc_release_block(block); | 733 | nlmsvc_release_block(block); |