]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
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 eb7dfb0d951382486f868a68f6e5b43c55185027..dd0f64f7bc060d85158aaacd85036f2679898e78 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 4c767175bd3428d4e8fb6e7a9c459bc58c3f7a12..3d1a63e95f698e032a8ad74a086f74d9bc04b70a 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 ab18b78f475553eba469c6ce71b151e69c6a2dd8..574d03f8a573b631214e28c6ffad6c2a5de6157f 100644 (file)
@@ -213,9 +213,9 @@ static int fuse_direntplus_link(struct file *file,
                }
 
                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,