Skip to content

Commit

Permalink
NFS: Fix a preemption count leak in nfs_update_request
Browse files Browse the repository at this point in the history
The commit 2785259 (nfs: use GFP_NOFS
preloads for radix-tree insertion) appears to have introduced a bug:
We only want to call radix_tree_preload() once after creating a request.
Calling it every time we loop after we created the request, will cause
preemption count leaks.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Nick Piggin <npiggin@suse.de>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Jul 9, 2008
1 parent 0b4aae7 commit f3d47a3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,6 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
/* Loop over all inode entries and see if we find
* A request for the page we wish to update
*/
if (new) {
if (radix_tree_preload(GFP_NOFS)) {
nfs_release_request(new);
return ERR_PTR(-ENOMEM);
}
}

spin_lock(&inode->i_lock);
req = nfs_page_find_request_locked(page);
if (req) {
Expand Down Expand Up @@ -630,6 +623,10 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
new = nfs_create_request(ctx, inode, page, offset, bytes);
if (IS_ERR(new))
return new;
if (radix_tree_preload(GFP_NOFS)) {
nfs_release_request(new);
return ERR_PTR(-ENOMEM);
}
}

/* We have a request for our page.
Expand Down

0 comments on commit f3d47a3

Please sign in to comment.