]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: don't check for quotas on MDS stray dirs
authorJeff Layton <jlayton@kernel.org>
Tue, 9 Nov 2021 14:54:49 +0000 (09:54 -0500)
committerJeff Layton <jlayton@kernel.org>
Mon, 15 Nov 2021 11:45:18 +0000 (06:45 -0500)
玮文 胡 reported seeing the WARN_RATELIMIT pop when writing to an
inode that had been transplanted into the stray dir. The client was
trying to look up the quotarealm info from the parent and that tripped
the warning.

Change the ceph_vino_is_reserved helper to not throw a warning and
add a new ceph_vino_warn_reserved helper that does. Change all of the
existing callsites to call the "warn" variant, and have
ceph_has_realms_with_quotas check return false when the vino is
reserved.

URL: https://tracker.ceph.com/issues/53180
Reported-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
Reviewed-by: Luis Henriques <lhenriques@suse.de>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/export.c
fs/ceph/inode.c
fs/ceph/quota.c
fs/ceph/super.h

index e0fa66ac8b9faa612969e0463ade52bc4b60d341..a75cf07d668f8db0bcce91709d8b7a7842c024d7 100644 (file)
@@ -130,7 +130,7 @@ static struct inode *__lookup_inode(struct super_block *sb, u64 ino)
        vino.ino = ino;
        vino.snap = CEPH_NOSNAP;
 
-       if (ceph_vino_is_reserved(vino))
+       if (ceph_vino_warn_reserved(vino))
                return ERR_PTR(-ESTALE);
 
        inode = ceph_find_inode(sb, vino);
@@ -224,7 +224,7 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb,
                vino.snap = sfh->snapid;
        }
 
-       if (ceph_vino_is_reserved(vino))
+       if (ceph_vino_warn_reserved(vino))
                return ERR_PTR(-ESTALE);
 
        inode = ceph_find_inode(sb, vino);
index e8eb8612ddd62ac47c6872f7bacfc35eedf2d830..a685fab567729fc069e6bc99f308a42449fbae07 100644 (file)
@@ -56,7 +56,7 @@ struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino)
 {
        struct inode *inode;
 
-       if (ceph_vino_is_reserved(vino))
+       if (ceph_vino_warn_reserved(vino))
                return ERR_PTR(-EREMOTEIO);
 
        inode = iget5_locked(sb, (unsigned long)vino.ino, ceph_ino_compare,
index 620c691af40e7e7a41698fd289e2c28546f28293..d1158c40bb0c6d68e8e696b764826abdb4c8867b 100644 (file)
@@ -30,6 +30,9 @@ static inline bool ceph_has_realms_with_quotas(struct inode *inode)
        /* if root is the real CephFS root, we don't have quota realms */
        if (root && ceph_ino(root) == CEPH_INO_ROOT)
                return false;
+       /* MDS stray dirs have no quota realms */
+       if (ceph_vino_is_reserved(ceph_inode(inode)->i_vino))
+               return false;
        /* otherwise, we can't know for sure */
        return true;
 }
index ed51e04739c4ffaf3805b858f0a218bf71f7916c..c232ed8e8a371d408c7af3ab2fa2a7048cac123c 100644 (file)
@@ -547,18 +547,21 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
 
 static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
 {
-       if (vino.ino < CEPH_INO_SYSTEM_BASE &&
-           vino.ino >= CEPH_MDS_INO_MDSDIR_OFFSET) {
-               WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino);
-               return true;
-       }
-       return false;
+       return vino.ino < CEPH_INO_SYSTEM_BASE &&
+              vino.ino >= CEPH_MDS_INO_MDSDIR_OFFSET;
+}
+
+static inline bool ceph_vino_warn_reserved(const struct ceph_vino vino)
+{
+       return WARN_RATELIMIT(ceph_vino_is_reserved(vino),
+                               "Attempt to access reserved inode number 0x%llx",
+                               vino.ino);
 }
 
 static inline struct inode *ceph_find_inode(struct super_block *sb,
                                            struct ceph_vino vino)
 {
-       if (ceph_vino_is_reserved(vino))
+       if (ceph_vino_warn_reserved(vino))
                return NULL;
 
        /*