From: Trond Myklebust Date: Wed, 4 Aug 2010 13:29:52 +0000 (-0400) Subject: NFS: Fix the locking in nfs4_callback_getattr X-Git-Tag: v2.6.36-rc1~498^2~3 X-Git-Url: https://bbs.cooldavid.org/git/?a=commitdiff_plain;h=761fe93cdfa29071879d882c92e966ae692c0048;p=net-next-2.6.git 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: Fred Isaman Signed-off-by: Trond Myklebust --- diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 7445dd0ae3f..930d10fecda 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -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); @@ -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);