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

[PATCH] knfsd: calls to break_lease in nfsd should be O_NONBLOCKing

If we would block, we return "err-jukebox" for nfsv3, or just drop the request
for v2.
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 1a494e59
......@@ -586,6 +586,7 @@ nfserrno (int errno)
{ nfserr_dquot, -EDQUOT },
#endif
{ nfserr_stale, -ESTALE },
{ nfserr_jukebox, -EWOULDBLOCK },
{ nfserr_jukebox, -ETIMEDOUT },
{ nfserr_dropit, -EAGAIN },
{ nfserr_dropit, -ENOMEM },
......
......@@ -328,6 +328,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp)
/* Now call the procedure handler, and encode NFS status. */
nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
if (nfserr == nfserr_jukebox && rqstp->rq_vers == 2)
nfserr = nfserr_dropit;
if (nfserr == nfserr_dropit) {
dprintk("nfsd: Dropping request due to malloc failure!\n");
nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
......
......@@ -303,8 +303,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
* If we are changing the size of the file, then
* we need to break all leases.
*/
err = break_lease(inode, FMODE_WRITE);
if (err)
err = break_lease(inode, FMODE_WRITE | O_NONBLOCK);
if (err) /* ENOMEM or EWOULDBLOCK */
goto out_nfserr;
err = get_write_access(inode);
......@@ -669,8 +669,8 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
* Check to see if there are any leases on this file.
* This may block while leases are broken.
*/
err = break_lease(inode, (access & MAY_WRITE) ? FMODE_WRITE : 0);
if (err)
err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0));
if (err) /* NOMEM or WOULDBLOCK */
goto out_nfserr;
if (access & MAY_WRITE) {
......
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