summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/inode.c16
-rw-r--r--fs/coda/dir.c2
-rw-r--r--include/linux/fs.h1
3 files changed, 15 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9dcc771ff485..3288f3a2899e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1991,8 +1991,14 @@ void btrfs_add_delayed_iput(struct inode *inode)
struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
struct delayed_iput *delayed;
- if (atomic_add_unless(&inode->i_count, -1, 1))
+ spin_lock(&inode->i_lock);
+ if (inode->i_count == 1) {
+ spin_unlock(&inode->i_lock);
return;
+ }
+ inode->i_count--;
+ spin_unlock(&inode->i_lock);
+
delayed = kmalloc(sizeof(*delayed), GFP_NOFS | __GFP_NOFAIL);
delayed->inode = inode;
@@ -3600,8 +3606,14 @@ again:
objectid = entry->vfs_inode.i_ino + 1;
inode = igrab(&entry->vfs_inode);
if (inode) {
+ int count;
spin_unlock(&root->inode_lock);
- if (atomic_read(&inode->i_count) > 1)
+
+ spin_lock(&inode->i_lock);
+ count = inode->i_count;
+ spin_unlock(&inode->i_lock);
+
+ if (count > 1)
d_prune_aliases(inode);
/*
* btrfs_drop_inode will remove it from
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index ee3410542b72..4d3bbd8514ac 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -613,7 +613,7 @@ static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd)
if (cii->c_flags & C_FLUSH)
coda_flag_inode_children(inode, C_FLUSH);
- if (de->d_count > 1)
+ if (atomic_read(&de->d_count) > 1)
/* pretend it's valid, but don't change the flags */
goto out;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 94b8fa3f486e..4981e6ee3ba5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,7 +8,6 @@
#include <linux/limits.h>
#include <linux/ioctl.h>
-#include <asm/atomic.h>
/*
* It's silly to have NR_OPEN bigger than NR_FILE, but you can change