When getting back an NLM DENIED response for a requested lock from the

server, map it to EAGAIN locally rather than EACCES.  The NLM spec
indicates the DENIED corresponds to lock contention, not a permission
failure.  This fixes O_EXLOCK/O_SHLOCK with O_NONBLOCK, which would
previously give a permission error, which in turn fixes things
like mailq(8) and lockf(1) over NFS.

Approved by:	scottl (re)
Reviewed by:	truckman, Andrew P Lentvorski, Jr. <bsder@allcaps.org>
Idea from:	truckman
This commit is contained in:
Robert Watson 2003-05-15 03:19:30 +00:00
parent 18e8d6d786
commit eda8b2821f

View File

@ -487,7 +487,7 @@ lock_answer(int pid, netobj *netcookie, int result, int *pid_p, int version)
break;
case nlm4_denied:
if (pid_p == NULL)
ans.la_errno = EACCES;
ans.la_errno = EAGAIN;
else {
/* this is an answer to a nlm_test msg */
ans.la_set_getlk_pid = 1;
@ -530,7 +530,7 @@ lock_answer(int pid, netobj *netcookie, int result, int *pid_p, int version)
break;
case nlm_denied:
if (pid_p == NULL)
ans.la_errno = EACCES;
ans.la_errno = EAGAIN;
else {
/* this is an answer to a nlm_test msg */
ans.la_set_getlk_pid = 1;