Skip to contentSkip to conversation

afs: remove redudant use of variable ret in afs_dir_iterate_contents

PATCH In review Colin Ian King 2 participants 2 messages Dec 4, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 afs: remove redudant use of variable ret in afs_dir_iterate_contents

The variable ret is being initialized with 0 and is never re-assigned. At the end of the function the check for ret being set to -ESTALE is always false, so the check and the call to afs_invalidate_dir is redundant. Remove ret and this check and just return 0 at the end of the function.

---
 fs/afs/dir.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/afs/dir.c +1 -4
index b6a202fd9926..83233814bd19 100644
@@ -488,7 +488,6 @@ static int afs_dir_iterate_contents(struct inode *dir, struct dir_context *ctx)
 	struct afs_vnode *dvnode = AFS_FS_I(dir);
 	struct iov_iter iter;
 	unsigned long long i_size = i_size_read(dir);
-	int ret = 0;
 
 	/* Round the file position up to the next entry boundary */
 	ctx->pos = round_up(ctx->pos, sizeof(union afs_xdr_dirent));
@@ -502,9 +501,7 @@ static int afs_dir_iterate_contents(struct inode *dir, struct dir_context *ctx)
 	iterate_folioq(&iter, iov_iter_count(&iter), dvnode, ctx,
 		       afs_dir_iterate_step);
 
-	if (ret == -ESTALE)
-		afs_invalidate_dir(dvnode, afs_dir_invalid_iter_stale);
-	return ret;
+	return 0;
 }
 
 /*
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 5 lines · Colin Ian King

The variable ret is being initialized with 0 and is never re-assigned. At the end of the function the check for ret being set to -ESTALE is always false, so the check and the call to afs_invalidate_dir is redundant. Remove ret and this check and just return 0 at the end of the function.

This is the wrong thing to do. We need to get the error out. I'm fixing my patch to do that.

Thanks,
David