Skip to contentSkip to conversation

ceph: only check pool permissions for regular files

PATCH In review Jeff Layton 3 participants 3 messages Mar 25, 2021 – Mar 29, 2021 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: only check pool permissions for regular files

There is no need to do a ceph_pool_perm_check() on anything that isn't a regular file, as the MDS is what handles talking to the OSD in those cases. Just return 0 if it's not a regular file.

---
 fs/ceph/addr.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/ceph/addr.c +4 -0
index d26a88aca014..07cbf21099b8 100644
@@ -1940,6 +1940,10 @@ int ceph_pool_perm_check(struct inode *inode, int need)
 	s64 pool;
 	int ret, flags;
 
+	/* Only need to do this for regular files */
+	if (!S_ISREG(inode->i_mode))
+		return 0;
+
 	if (ci->i_vino.snap != CEPH_NOSNAP) {
 		/*
 		 * Pool permission check needs to write to the first object.
Signature · 1 line
2.30.2
#1 lore raw
Quoted 5 lines · Jeff Layton

There is no need to do a ceph_pool_perm_check() on anything that isn't a regular file, as the MDS is what handles talking to the OSD in those cases. Just return 0 if it's not a regular file.

Looks good to me, thanks!

[ Took me a while to find when/where I reported that -- it was completely
swapped out from my memory! But I finally found it on my IRC logs. ]

Cheers,
--
Luís

Quoted 23 lines
---
 fs/ceph/addr.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/ceph/addr.c +4 -0
index d26a88aca014..07cbf21099b8 100644
@@ -1940,6 +1940,10 @@ int ceph_pool_perm_check(struct inode *inode, int need)
 	s64 pool;
 	int ret, flags;
 
+	/* Only need to do this for regular files */
+	if (!S_ISREG(inode->i_mode))
+		return 0;
+
 	if (ci->i_vino.snap != CEPH_NOSNAP) {
 		/*
 		 * Pool permission check needs to write to the first object.
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jeff Layton
Quoted 15 lines · Jeff Layton

There is no need to do a ceph_pool_perm_check() on anything that isn't a regular file, as the MDS is what handles talking to the OSD in those cases. Just return 0 if it's not a regular file.

---
  fs/ceph/addr.c | 4 ++++
  1 file changed, 4 insertions(+)
fs/ceph/addr.c +0 -0
index d26a88aca014..07cbf21099b8 100644

fs/ceph/addr.c int ceph_pool_perm_check(struct inode *inode, int need) · line 1949

Quoted 10 lines
fs/ceph/addr.c +4 -0
@@ -1940,6 +1940,10 @@ int ceph_pool_perm_check(struct inode *inode, int need)
  	s64 pool;
  	int ret, flags;
 
+	/* Only need to do this for regular files */
+	if (!S_ISREG(inode->i_mode))
+		return 0;
+
  	if (ci->i_vino.snap != CEPH_NOSNAP) {
  		/*
  		 * Pool permission check needs to write to the first object.