From 342c2065501d2502b410698935c71b7194a8ad33 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 9 Dec 2022 15:58:52 -0800 Subject: [PATCH] Have scoutfs_forest_inode_count return stale reads scoutfs_forest_inode_count() assumed it was called with stable refs and would always translate ESTALE to EIO. Change it so that it passes ESTALE to the caller who is responsible for handling it. The server will use this to retry reading from stable supers that it's storing in memory. Signed-off-by: Zach Brown --- kmod/src/forest.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/kmod/src/forest.c b/kmod/src/forest.c index 1b4c9c4b..37705c62 100644 --- a/kmod/src/forest.c +++ b/kmod/src/forest.c @@ -541,9 +541,8 @@ void scoutfs_forest_dec_inode_count(struct super_block *sb) /* * Return the total inode count from the super block and all the - * log_btrees it references. This assumes it's working with a block - * reference hierarchy that should be fully consistent. If we see - * ESTALE we've hit persistent corruption. + * log_btrees it references. ESTALE from read blocks is returned to the + * caller who is expected to retry or return hard errors. */ int scoutfs_forest_inode_count(struct super_block *sb, struct scoutfs_super_block *super, u64 *inode_count) @@ -572,8 +571,6 @@ int scoutfs_forest_inode_count(struct super_block *sb, struct scoutfs_super_bloc if (ret < 0) { if (ret == -ENOENT) ret = 0; - else if (ret == -ESTALE) - ret = -EIO; break; } }