]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ceph: add d_drop for some error cases in ceph_mknod()
authorChengguang Xu <cgxu519@gmx.com>
Mon, 9 Jul 2018 14:17:30 +0000 (22:17 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 2 Aug 2018 19:26:12 +0000 (21:26 +0200)
When file num exceeds quota limit or fails from ceph_per_init_acls()
should call d_drop to drop dentry from cache as well.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/dir.c

index 036ac0f3a393afe98278cd388de4e68b7e4b286c..4b6a49fd2a611d0790fc43992c060a635ff309dd 100644 (file)
@@ -827,12 +827,14 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
        if (ceph_snap(dir) != CEPH_NOSNAP)
                return -EROFS;
 
-       if (ceph_quota_is_max_files_exceeded(dir))
-               return -EDQUOT;
+       if (ceph_quota_is_max_files_exceeded(dir)) {
+               err = -EDQUOT;
+               goto out;
+       }
 
        err = ceph_pre_init_acls(dir, &mode, &acls);
        if (err < 0)
-               return err;
+               goto out;
 
        dout("mknod in dir %p dentry %p mode 0%ho rdev %d\n",
             dir, dentry, mode, rdev);