summaryrefslogtreecommitdiff
path: root/fs/ceph/quota.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2018-01-12 16:26:17 +0800
committerIlya Dryomov <idryomov@gmail.com>2018-04-02 11:17:52 +0200
commit2596366907f872de7be0557720bb55bccf7489d9 (patch)
tree9b89462ea14d9a0b812f580eaea72991343f654d /fs/ceph/quota.c
parent1ab302a0cb1455631646aa66b7fc02afd617ea4f (diff)
ceph: don't check quota for snap inode
snap inode's i_snap_realm is not pointing to ceph_snap_realm. Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/quota.c')
-rw-r--r--fs/ceph/quota.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c
index 7d1e18e2249f..529de67393a9 100644
--- a/fs/ceph/quota.c
+++ b/fs/ceph/quota.c
@@ -86,8 +86,15 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
struct ceph_vino vino;
struct inode *in;
+ if (ceph_snap(inode) != CEPH_NOSNAP)
+ return NULL;
+
realm = ceph_inode(inode)->i_snap_realm;
- ceph_get_snap_realm(mdsc, realm);
+ if (realm)
+ ceph_get_snap_realm(mdsc, realm);
+ else
+ pr_err_ratelimited("get_quota_realm: ino (%llx.%llx) "
+ "null i_snap_realm\n", ceph_vinop(inode));
while (realm) {
vino.ino = realm->ino;
vino.snap = CEPH_NOSNAP;
@@ -158,9 +165,16 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
bool is_root;
bool exceeded = false;
+ if (ceph_snap(inode) != CEPH_NOSNAP)
+ return false;
+
down_read(&mdsc->snap_rwsem);
realm = ceph_inode(inode)->i_snap_realm;
- ceph_get_snap_realm(mdsc, realm);
+ if (realm)
+ ceph_get_snap_realm(mdsc, realm);
+ else
+ pr_err_ratelimited("check_quota_exceeded: ino (%llx.%llx) "
+ "null i_snap_realm\n", ceph_vinop(inode));
while (realm) {
vino.ino = realm->ino;
vino.snap = CEPH_NOSNAP;