[PATCH][next] afs: remove redudant use of variable ret in afs_dir_iterate_contents

Colin Ian King posted 1 patch 1 year ago
fs/afs/dir.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
[PATCH][next] afs: remove redudant use of variable ret in afs_dir_iterate_contents
Posted by Colin Ian King 1 year ago
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.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/afs/dir.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index b6a202fd9926..83233814bd19 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -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;
 }
 
 /*
-- 
2.39.5
Re: [PATCH][next] afs: remove redudant use of variable ret in afs_dir_iterate_contents
Posted by David Howells 1 year ago
Colin Ian King <colin.i.king@gmail.com> wrote:

> 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