Commit 761fe93c authored by Trond Myklebust's avatar Trond Myklebust

NFS: Fix the locking in nfs4_callback_getattr

The delegation is protected by RCU now, so we need to replace the
nfsi->rwsem protection with an rcu protected section.
Reported-by: default avatarFred Isaman <iisaman@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 0d8a3746
...@@ -37,8 +37,8 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres * ...@@ -37,8 +37,8 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *
if (inode == NULL) if (inode == NULL)
goto out_putclient; goto out_putclient;
nfsi = NFS_I(inode); nfsi = NFS_I(inode);
down_read(&nfsi->rwsem); rcu_read_lock();
delegation = nfsi->delegation; delegation = rcu_dereference(nfsi->delegation);
if (delegation == NULL || (delegation->type & FMODE_WRITE) == 0) if (delegation == NULL || (delegation->type & FMODE_WRITE) == 0)
goto out_iput; goto out_iput;
res->size = i_size_read(inode); res->size = i_size_read(inode);
...@@ -53,7 +53,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres * ...@@ -53,7 +53,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *
args->bitmap[1]; args->bitmap[1];
res->status = 0; res->status = 0;
out_iput: out_iput:
up_read(&nfsi->rwsem); rcu_read_unlock();
iput(inode); iput(inode);
out_putclient: out_putclient:
nfs_put_client(clp); nfs_put_client(clp);
......
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