aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2016-12-13 03:03:26 -0500
committerIlya Dryomov <idryomov@gmail.com>2016-12-14 16:39:04 -0500
commit80e80fbb584dc0d0dc894c4965bc2a199c7cd3f2 (patch)
tree1ed1cb12474a097c20c23dadf9261139df083132
parentdc24de82d61b1edc3d195badd178e7875ba9398f (diff)
ceph: avoid creating orphan object when checking pool permission
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>
-rw-r--r--fs/ceph/addr.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 7d69f25d0c90..a0f1e2b91c8e 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1948,6 +1948,15 @@ int ceph_pool_perm_check(struct ceph_inode_info *ci, int need)
1948 struct ceph_string *pool_ns; 1948 struct ceph_string *pool_ns;
1949 int ret, flags; 1949 int ret, flags;
1950 1950
1951 if (ci->i_vino.snap != CEPH_NOSNAP) {
1952 /*
1953 * Pool permission check needs to write to the first object.
1954 * But for snapshot, head of the first object may have alread
1955 * been deleted. Skip check to avoid creating orphan object.
1956 */
1957 return 0;
1958 }
1959
1951 if (ceph_test_mount_opt(ceph_inode_to_client(&ci->vfs_inode), 1960 if (ceph_test_mount_opt(ceph_inode_to_client(&ci->vfs_inode),
1952 NOPOOLPERM)) 1961 NOPOOLPERM))
1953 return 0; 1962 return 0;