fuse: Protect fi->nlookup with fi->lock
authorKirill Tkhai <ktkhai@virtuozzo.com>
Fri, 9 Nov 2018 10:33:27 +0000 (13:33 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 13 Feb 2019 12:15:14 +0000 (13:15 +0100)
This continues previous patch and introduces the same protection for
nlookup field.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dir.c
fs/fuse/inode.c
fs/fuse/readdir.c

index eb7dfb0..dd0f64f 100644 (file)
@@ -207,9 +207,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
                                fuse_queue_forget(fc, forget, outarg.nodeid, 1);
                                goto invalid;
                        }
-                       spin_lock(&fc->lock);
+                       spin_lock(&fi->lock);
                        fi->nlookup++;
-                       spin_unlock(&fc->lock);
+                       spin_unlock(&fi->lock);
                }
                kfree(forget);
                if (ret == -ENOMEM)
index 4c76717..3d1a63e 100644 (file)
@@ -325,9 +325,9 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
        }
 
        fi = get_fuse_inode(inode);
-       spin_lock(&fc->lock);
+       spin_lock(&fi->lock);
        fi->nlookup++;
-       spin_unlock(&fc->lock);
+       spin_unlock(&fi->lock);
        fuse_change_attributes(inode, attr, attr_valid, attr_version);
 
        return inode;
index ab18b78..574d03f 100644 (file)
@@ -213,9 +213,9 @@ retry:
                }
 
                fi = get_fuse_inode(inode);
-               spin_lock(&fc->lock);
+               spin_lock(&fi->lock);
                fi->nlookup++;
-               spin_unlock(&fc->lock);
+               spin_unlock(&fi->lock);
 
                forget_all_cached_acls(inode);
                fuse_change_attributes(inode, &o->attr,