Commit a900aeb7 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] knfsd: nfsd_translate_wouldblocks

-EAGAIN has a special treatment in the nfsd code since it's used to indicate
that an upcall has been initiated and that a request should be dropped pending
the upcall result.

But when the break_lease functions return -EWOULDBLOCK (==-EAGAIN on most
architectures), we actually prefer to return nfserr_jukebox.  So translate
-EAGAIN returns to -ETIMEDOUT (which will be translated to nfserr_jukebox).

Undo the mapping of -EWOULDBLOCK to nfserr_jukebox, since on most
architectures that has the undesireable effect of mapping -EAGAIN to
nfserr_jukebox.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ca6b9547
......@@ -586,7 +586,6 @@ nfserrno (int errno)
{ nfserr_dquot, -EDQUOT },
#endif
{ nfserr_stale, -ESTALE },
{ nfserr_jukebox, -EWOULDBLOCK },
{ nfserr_jukebox, -ETIMEDOUT },
{ nfserr_dropit, -EAGAIN },
{ nfserr_dropit, -ENOMEM },
......
......@@ -304,6 +304,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
* we need to break all leases.
*/
err = break_lease(inode, FMODE_WRITE | O_NONBLOCK);
if (err == -EWOULDBLOCK)
err = -ETIMEDOUT;
if (err) /* ENOMEM or EWOULDBLOCK */
goto out_nfserr;
......@@ -668,6 +670,8 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
* This may block while leases are broken.
*/
err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0));
if (err == -EWOULDBLOCK)
err = -ETIMEDOUT;
if (err) /* NOMEM or WOULDBLOCK */
goto out_nfserr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment