From 9523e99046b9d03ab1e5b75622e1f80e02fcc8e9 Mon Sep 17 00:00:00 2001 From: Artem Blagodarenko Date: Wed, 13 Apr 2022 16:01:58 -0400 Subject: [PATCH] LU-15754 lfsck: skip an inode if iget() returns -ENOMEM After the change commit c2b6d621c4ffe9936adf7a55c8b1c769672c306f Author: Al Viro Date: Thu Jun 28 15:53:17 2018 -0400 new primitive: discard_new_inode() find_inode_fast() returns -ESTALE, but iget_locked() replaces it to the NULL and finally ldiskfs_inode_attach_jinode() returns -ENOMEM. So this check in osd_iit_iget() doesn't work. if (rc == -ENOENT || rc == -ESTALE) RETURN(SCRUB_NEXT_CONTINUE); As a solution we can skip an inode if -ENOMEM returned Hpe-bug-id: LUS-10833 Change-Id: Icb30610e46e2ab899a512761b63aea248c4f2ada Signed-off-by: Artem Blagodarenko Reviewed-on: https://review.whamcloud.com/47079 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Andrew Perepechko Reviewed-by: Alexander Zarochentsev Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_scrub.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index 0605c31..abc3295 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -608,8 +608,14 @@ static int osd_iit_iget(struct osd_thread_info *info, struct osd_device *dev, if (IS_ERR(inode)) { rc = PTR_ERR(inode); /* The inode may be removed after bitmap searching, or the - * file is new created without inode initialized yet. */ - if (rc == -ENOENT || rc == -ESTALE) + * file is new created without inode initialized yet. + * LU-15754: After "new primitive: discard_new_inode()" change + * in the kernel find_inode_fast() returns -ESTALE, but + * iget_locked replaces it to the NULL and finally + * ldiskfs_inode_attach_jinode() returns -ENOMEM + * Let's skip an inode if -ENOMEM returned. + */ + if (rc == -ENOENT || rc == -ESTALE || rc == -ENOMEM) RETURN(SCRUB_NEXT_CONTINUE); CDEBUG(D_LFSCK, "%s: fail to read inode, ino# = %u: " -- 1.8.3.1