
From: NeilBrown <neilb@cse.unsw.edu.au>

-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: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/nfsd/nfsproc.c |    1 -
 25-akpm/fs/nfsd/vfs.c     |    4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff -puN fs/nfsd/nfsproc.c~knfsd-nfsd_translate_wouldblocks fs/nfsd/nfsproc.c
--- 25/fs/nfsd/nfsproc.c~knfsd-nfsd_translate_wouldblocks	Thu Nov 18 15:18:10 2004
+++ 25-akpm/fs/nfsd/nfsproc.c	Thu Nov 18 15:18:10 2004
@@ -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 },
diff -puN fs/nfsd/vfs.c~knfsd-nfsd_translate_wouldblocks fs/nfsd/vfs.c
--- 25/fs/nfsd/vfs.c~knfsd-nfsd_translate_wouldblocks	Thu Nov 18 15:18:10 2004
+++ 25-akpm/fs/nfsd/vfs.c	Thu Nov 18 15:18:10 2004
@@ -304,6 +304,8 @@ nfsd_setattr(struct svc_rqst *rqstp, str
 		 * 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
 	 * 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;
 
_
