summaryrefslogtreecommitdiffstats
path: root/fs/ceph/addr.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2016-12-13 09:03:26 +0100
committerIlya Dryomov <idryomov@gmail.com>2016-12-14 22:39:04 +0100
commit80e80fbb584dc0d0dc894c4965bc2a199c7cd3f2 (patch)
tree1ed1cb12474a097c20c23dadf9261139df083132 /fs/ceph/addr.c
parentceph: properly set issue_seq for cap release (diff)
downloadlinux-80e80fbb584dc0d0dc894c4965bc2a199c7cd3f2.tar.xz
linux-80e80fbb584dc0d0dc894c4965bc2a199c7cd3f2.zip
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>
Diffstat (limited to 'fs/ceph/addr.c')
-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)
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;