ceph: don't check quota for snap inode
authorYan, Zheng <zyan@redhat.com>
Fri, 12 Jan 2018 08:26:17 +0000 (16:26 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 2 Apr 2018 09:17:52 +0000 (11:17 +0200)
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>
fs/ceph/dir.c
fs/ceph/quota.c

index 1f60498..6cd92a0 100644 (file)
@@ -936,7 +936,8 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
                goto out;
        }
 
-       if (ceph_quota_is_max_files_exceeded(dir)) {
+       if (op == CEPH_MDS_OP_MKDIR &&
+           ceph_quota_is_max_files_exceeded(dir)) {
                err = -EDQUOT;
                goto out;
        }
index 7d1e18e..529de67 100644 (file)
@@ -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;