diff options
author | Yan, Zheng <zyan@redhat.com> | 2018-01-12 16:55:31 +0800 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-04-02 11:17:52 +0200 |
commit | 0eb6bbe4d9cf02f639d661edf7c02defc3453a69 (patch) | |
tree | 4ce11a9dd579d05224434c4ff276851421d1cec1 /fs/ceph | |
parent | 2596366907f872de7be0557720bb55bccf7489d9 (diff) | |
download | op-kernel-dev-0eb6bbe4d9cf02f639d661edf7c02defc3453a69.zip op-kernel-dev-0eb6bbe4d9cf02f639d661edf7c02defc3453a69.tar.gz |
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.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c index 529de67..121819b 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, struct ceph_snap_realm *realm, *next; struct ceph_vino vino; struct inode *in; + bool has_quota; if (ceph_snap(inode) != CEPH_NOSNAP) return NULL; @@ -104,12 +105,13 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc, break; } ci = ceph_inode(in); - if (ceph_has_quota(ci) || (ci->i_vino.ino == CEPH_INO_ROOT)) { - iput(in); - return realm; - } + has_quota = ceph_has_quota(ci); iput(in); + next = realm->parent; + if (has_quota || !next) + return realm; + ceph_get_snap_realm(mdsc, next); ceph_put_snap_realm(mdsc, realm); realm = next; @@ -162,7 +164,6 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, struct ceph_vino vino; struct inode *in; u64 max, rvalue; - bool is_root; bool exceeded = false; if (ceph_snap(inode) != CEPH_NOSNAP) @@ -192,7 +193,6 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, max = ci->i_max_bytes; rvalue = ci->i_rbytes; } - is_root = (ci->i_vino.ino == CEPH_INO_ROOT); spin_unlock(&ci->i_ceph_lock); switch (op) { case QUOTA_CHECK_MAX_FILES_OP: @@ -222,9 +222,9 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, } iput(in); - if (is_root || exceeded) - break; next = realm->parent; + if (exceeded || !next) + break; ceph_get_snap_realm(mdsc, next); ceph_put_snap_realm(mdsc, realm); realm = next; |