Browse Source

NFS: Fix buglet in fs/nfs/write.c

I've been reading through fs/nfs/write.c trying to track down a bug
that seems to be related to pages loosing a refcount and getting
freed too early (you interested in detail??) and I spotted a little
bug which the following patch should fix.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Neil Brown 19 years ago
parent
commit
1dd594b21b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      fs/nfs/write.c

+ 4 - 1
fs/nfs/write.c

@@ -653,8 +653,11 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
 				spin_unlock(&nfsi->req_lock);
 				spin_unlock(&nfsi->req_lock);
 				error = nfs_wait_on_request(req);
 				error = nfs_wait_on_request(req);
 				nfs_release_request(req);
 				nfs_release_request(req);
-				if (error < 0)
+				if (error < 0) {
+					if (new)
+						nfs_release_request(new);
 					return ERR_PTR(error);
 					return ERR_PTR(error);
+				}
 				continue;
 				continue;
 			}
 			}
 			spin_unlock(&nfsi->req_lock);
 			spin_unlock(&nfsi->req_lock);