diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-06-11 21:44:04 +0200 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-07-16 00:10:50 +0200 |
commit | 1b83d707032a1be40a60ed0a9bd841662cc04a5d (patch) | |
tree | 4c39cb618026a4480e06e5ed0d30c7a553a6fabf /fs | |
parent | nfs: set correct fl_len in nlmclnt_test() (diff) | |
download | linux-1b83d707032a1be40a60ed0a9bd841662cc04a5d.tar.xz linux-1b83d707032a1be40a60ed0a9bd841662cc04a5d.zip |
NFS: Protect inode->i_nlink updates using inode->i_lock
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index b1940660502f..d6ec1c85995a 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -870,6 +870,14 @@ static int nfs_dentry_delete(struct dentry *dentry) } +static void nfs_drop_nlink(struct inode *inode) +{ + spin_lock(&inode->i_lock); + if (inode->i_nlink > 0) + drop_nlink(inode); + spin_unlock(&inode->i_lock); +} + /* * Called when the dentry loses inode. * We use it to clean up silly-renamed files. @@ -1420,7 +1428,7 @@ static int nfs_safe_remove(struct dentry *dentry) error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); /* The VFS may want to delete this inode */ if (error == 0) - drop_nlink(inode); + nfs_drop_nlink(inode); nfs_mark_for_revalidate(inode); } else error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); @@ -1647,7 +1655,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, /* dentry still busy? */ goto out; } else - drop_nlink(new_inode); + nfs_drop_nlink(new_inode); go_ahead: /* |