aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2018-01-12 03:55:31 -0500
committerIlya Dryomov <idryomov@gmail.com>2018-04-02 05:17:52 -0400
commit0eb6bbe4d9cf02f639d661edf7c02defc3453a69 (patch)
tree4ce11a9dd579d05224434c4ff276851421d1cec1 /fs/ceph
parent2596366907f872de7be0557720bb55bccf7489d9 (diff)
ceph: fix root quota realm check
Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/quota.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c
index 529de67393a9..121819baeb58 100644
--- a/fs/ceph/quota.c
+++ b/fs/ceph/quota.c
@@ -85,6 +85,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
85 struct ceph_snap_realm *realm, *next; 85 struct ceph_snap_realm *realm, *next;
86 struct ceph_vino vino; 86 struct ceph_vino vino;
87 struct inode *in; 87 struct inode *in;
88 bool has_quota;
88 89
89 if (ceph_snap(inode) != CEPH_NOSNAP) 90 if (ceph_snap(inode) != CEPH_NOSNAP)
90 return NULL; 91 return NULL;
@@ -104,12 +105,13 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
104 break; 105 break;
105 } 106 }
106 ci = ceph_inode(in); 107 ci = ceph_inode(in);
107 if (ceph_has_quota(ci) || (ci->i_vino.ino == CEPH_INO_ROOT)) { 108 has_quota = ceph_has_quota(ci);
108 iput(in);
109 return realm;
110 }
111 iput(in); 109 iput(in);
110
112 next = realm->parent; 111 next = realm->parent;
112 if (has_quota || !next)
113 return realm;
114
113 ceph_get_snap_realm(mdsc, next); 115 ceph_get_snap_realm(mdsc, next);
114 ceph_put_snap_realm(mdsc, realm); 116 ceph_put_snap_realm(mdsc, realm);
115 realm = next; 117 realm = next;
@@ -162,7 +164,6 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
162 struct ceph_vino vino; 164 struct ceph_vino vino;
163 struct inode *in; 165 struct inode *in;
164 u64 max, rvalue; 166 u64 max, rvalue;
165 bool is_root;
166 bool exceeded = false; 167 bool exceeded = false;
167 168
168 if (ceph_snap(inode) != CEPH_NOSNAP) 169 if (ceph_snap(inode) != CEPH_NOSNAP)
@@ -192,7 +193,6 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
192 max = ci->i_max_bytes; 193 max = ci->i_max_bytes;
193 rvalue = ci->i_rbytes; 194 rvalue = ci->i_rbytes;
194 } 195 }
195 is_root = (ci->i_vino.ino == CEPH_INO_ROOT);
196 spin_unlock(&ci->i_ceph_lock); 196 spin_unlock(&ci->i_ceph_lock);
197 switch (op) { 197 switch (op) {
198 case QUOTA_CHECK_MAX_FILES_OP: 198 case QUOTA_CHECK_MAX_FILES_OP:
@@ -222,9 +222,9 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
222 } 222 }
223 iput(in); 223 iput(in);
224 224
225 if (is_root || exceeded)
226 break;
227 next = realm->parent; 225 next = realm->parent;
226 if (exceeded || !next)
227 break;
228 ceph_get_snap_realm(mdsc, next); 228 ceph_get_snap_realm(mdsc, next);
229 ceph_put_snap_realm(mdsc, realm); 229 ceph_put_snap_realm(mdsc, realm);
230 realm = next; 230 realm = next;