Skip to content

Commit 0078ea3

Browse files
jtlaytonidryomov
authored andcommitted
ceph: don't check for quotas on MDS stray dirs
玮文 胡 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 for MDS stray directories (0x100 - 0x1ff), only for reserved dirs that are not in that range. Also, fix ceph_has_realms_with_quotas to return false when encountering a reserved inode. URL: https://tracker.ceph.com/issues/53180 Reported-by: Hu Weiwen <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Reviewed-by: Luis Henriques <[email protected]> Reviewed-by: Xiubo Li <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent af9ceae commit 0078ea3

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

fs/ceph/quota.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ static inline bool ceph_has_realms_with_quotas(struct inode *inode)
3030
/* if root is the real CephFS root, we don't have quota realms */
3131
if (root && ceph_ino(root) == CEPH_INO_ROOT)
3232
return false;
33+
/* MDS stray dirs have no quota realms */
34+
if (ceph_vino_is_reserved(ceph_inode(inode)->i_vino))
35+
return false;
3336
/* otherwise, we can't know for sure */
3437
return true;
3538
}

fs/ceph/super.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -539,19 +539,23 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
539539
*
540540
* These come from src/mds/mdstypes.h in the ceph sources.
541541
*/
542-
#define CEPH_MAX_MDS 0x100
543-
#define CEPH_NUM_STRAY 10
542+
#define CEPH_MAX_MDS 0x100
543+
#define CEPH_NUM_STRAY 10
544544
#define CEPH_MDS_INO_MDSDIR_OFFSET (1 * CEPH_MAX_MDS)
545+
#define CEPH_MDS_INO_LOG_OFFSET (2 * CEPH_MAX_MDS)
545546
#define CEPH_INO_SYSTEM_BASE ((6*CEPH_MAX_MDS) + (CEPH_MAX_MDS * CEPH_NUM_STRAY))
546547

547548
static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
548549
{
549-
if (vino.ino < CEPH_INO_SYSTEM_BASE &&
550-
vino.ino >= CEPH_MDS_INO_MDSDIR_OFFSET) {
551-
WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino);
552-
return true;
553-
}
554-
return false;
550+
if (vino.ino >= CEPH_INO_SYSTEM_BASE ||
551+
vino.ino < CEPH_MDS_INO_MDSDIR_OFFSET)
552+
return false;
553+
554+
/* Don't warn on mdsdirs */
555+
WARN_RATELIMIT(vino.ino >= CEPH_MDS_INO_LOG_OFFSET,
556+
"Attempt to access reserved inode number 0x%llx",
557+
vino.ino);
558+
return true;
555559
}
556560

557561
static inline struct inode *ceph_find_inode(struct super_block *sb,

0 commit comments

Comments
 (0)