@@ -85,6 +85,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
85
85
struct ceph_snap_realm * realm , * next ;
86
86
struct ceph_vino vino ;
87
87
struct inode * in ;
88
+ bool has_quota ;
88
89
89
90
if (ceph_snap (inode ) != CEPH_NOSNAP )
90
91
return NULL ;
@@ -104,12 +105,13 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
104
105
break ;
105
106
}
106
107
ci = ceph_inode (in );
107
- if (ceph_has_quota (ci ) || (ci -> i_vino .ino == CEPH_INO_ROOT )) {
108
- iput (in );
109
- return realm ;
110
- }
108
+ has_quota = ceph_has_quota (ci );
111
109
iput (in );
110
+
112
111
next = realm -> parent ;
112
+ if (has_quota || !next )
113
+ return realm ;
114
+
113
115
ceph_get_snap_realm (mdsc , next );
114
116
ceph_put_snap_realm (mdsc , realm );
115
117
realm = next ;
@@ -162,7 +164,6 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
162
164
struct ceph_vino vino ;
163
165
struct inode * in ;
164
166
u64 max , rvalue ;
165
- bool is_root ;
166
167
bool exceeded = false;
167
168
168
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
193
max = ci -> i_max_bytes ;
193
194
rvalue = ci -> i_rbytes ;
194
195
}
195
- is_root = (ci -> i_vino .ino == CEPH_INO_ROOT );
196
196
spin_unlock (& ci -> i_ceph_lock );
197
197
switch (op ) {
198
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
223
iput (in );
224
224
225
- if (is_root || exceeded )
226
- break ;
227
225
next = realm -> parent ;
226
+ if (exceeded || !next )
227
+ break ;
228
228
ceph_get_snap_realm (mdsc , next );
229
229
ceph_put_snap_realm (mdsc , realm );
230
230
realm = next ;
0 commit comments