Skip to content

Commit

Permalink
NFS: Fix the locking in nfs4_callback_getattr
Browse files Browse the repository at this point in the history
The delegation is protected by RCU now, so we need to replace the
nfsi->rwsem protection with an rcu protected section.

Reported-by: Fred Isaman <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Aug 6, 2010
1 parent 0d8a374 commit 761fe93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/nfs/callback_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *
if (inode == NULL)
goto out_putclient;
nfsi = NFS_I(inode);
down_read(&nfsi->rwsem);
delegation = nfsi->delegation;
rcu_read_lock();
delegation = rcu_dereference(nfsi->delegation);
if (delegation == NULL || (delegation->type & FMODE_WRITE) == 0)
goto out_iput;
res->size = i_size_read(inode);
Expand All @@ -53,7 +53,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *
args->bitmap[1];
res->status = 0;
out_iput:
up_read(&nfsi->rwsem);
rcu_read_unlock();
iput(inode);
out_putclient:
nfs_put_client(clp);
Expand Down

0 comments on commit 761fe93

Please sign in to comment.