]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ceph: avoid creating orphan object when checking pool permission
authorYan, Zheng <zyan@redhat.com>
Tue, 13 Dec 2016 08:03:26 +0000 (16:03 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 14 Dec 2016 21:39:04 +0000 (22:39 +0100)
Pool permission check needs to write to the first object. But for
snapshot, head of the first object may have already been deleted.
Skip the check for snapshot inode to avoid creating orphan object.

Link: http://tracker.ceph.com/issues/18211
Signed-off-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/addr.c

index 7d69f25d0c901e9c52f89e1d3afa2554be8559bf..a0f1e2b91c8e0f46051e398b663f89220365f187 100644 (file)
@@ -1948,6 +1948,15 @@ int ceph_pool_perm_check(struct ceph_inode_info *ci, int need)
        struct ceph_string *pool_ns;
        int ret, flags;
 
+       if (ci->i_vino.snap != CEPH_NOSNAP) {
+               /*
+                * Pool permission check needs to write to the first object.
+                * But for snapshot, head of the first object may have alread
+                * been deleted. Skip check to avoid creating orphan object.
+                */
+               return 0;
+       }
+
        if (ceph_test_mount_opt(ceph_inode_to_client(&ci->vfs_inode),
                                NOPOOLPERM))
                return 0;