* [PATCH-next] afs: Remove logically dead code
@ 2024-11-16 6:36 Advait Dhamorikar
2024-11-18 15:18 ` David Howells
2024-11-18 16:09 ` David Howells
0 siblings, 2 replies; 4+ messages in thread
From: Advait Dhamorikar @ 2024-11-16 6:36 UTC (permalink / raw)
To: David Howells, Marc Dionne; +Cc: linux-afs, linux-kernel, Advait Dhamorikar
Initially ret is initialized to 0 and its value is then never updated
again, thus the indicated dead code may have performed some action;
that action will never occur.
Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
---
fs/afs/dir.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index b6a202fd9926..afa7c24828ec 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -502,8 +502,6 @@ 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;
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH-next] afs: Remove logically dead code
2024-11-16 6:36 [PATCH-next] afs: Remove logically dead code Advait Dhamorikar
@ 2024-11-18 15:18 ` David Howells
2024-11-18 19:16 ` Advait Dhamorikar
2024-11-18 16:09 ` David Howells
1 sibling, 1 reply; 4+ messages in thread
From: David Howells @ 2024-11-18 15:18 UTC (permalink / raw)
To: Advait Dhamorikar; +Cc: dhowells, Marc Dionne, linux-afs, linux-kernel
Advait Dhamorikar <advaitdhamorikar@gmail.com> wrote:
> 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;
Removing this is the wrong thing to do. However, you're correct that ret is
never set to -ESTALE.
A better solution, I think, is to check the result of iterate_folioq(),
invalidating the dir and returning -ESTALE if 0 and if the iterator count is
not 0.
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH-next] afs: Remove logically dead code
2024-11-18 15:18 ` David Howells
@ 2024-11-18 19:16 ` Advait Dhamorikar
0 siblings, 0 replies; 4+ messages in thread
From: Advait Dhamorikar @ 2024-11-18 19:16 UTC (permalink / raw)
To: David Howells; +Cc: Marc Dionne, linux-afs, linux-kernel
Hello David,
> A better solution, I think, is to check the result of iterate_folioq(),
> invalidating the dir and returning -ESTALE if 0 and if the iterator count is
> not 0.
Thanks for the insights and the feedback, however it looks like this patch
is no longer relevant as there have been significant changes to the
file since then.
Best regards,
Advait
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH-next] afs: Remove logically dead code
2024-11-16 6:36 [PATCH-next] afs: Remove logically dead code Advait Dhamorikar
2024-11-18 15:18 ` David Howells
@ 2024-11-18 16:09 ` David Howells
1 sibling, 0 replies; 4+ messages in thread
From: David Howells @ 2024-11-18 16:09 UTC (permalink / raw)
To: Advait Dhamorikar; +Cc: dhowells, Marc Dionne, linux-afs, linux-kernel
I think the attached change is what I want.
David
---
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index b6a202fd9926..2adc034603f2 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -499,11 +499,11 @@ static int afs_dir_iterate_contents(struct inode *dir, struct dir_context *ctx)
iov_iter_folio_queue(&iter, ITER_SOURCE, dvnode->directory, 0, 0, i_size);
iov_iter_advance(&iter, round_down(ctx->pos, AFS_DIR_BLOCK_SIZE));
- iterate_folioq(&iter, iov_iter_count(&iter), dvnode, ctx,
- afs_dir_iterate_step);
-
- if (ret == -ESTALE)
+ if (!iterate_folioq(&iter, iov_iter_count(&iter), dvnode, ctx,
+ afs_dir_iterate_step)) {
afs_invalidate_dir(dvnode, afs_dir_invalid_iter_stale);
+ ret = -ESTALE;
+ }
return ret;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-18 19:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-16 6:36 [PATCH-next] afs: Remove logically dead code Advait Dhamorikar
2024-11-18 15:18 ` David Howells
2024-11-18 19:16 ` Advait Dhamorikar
2024-11-18 16:09 ` David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®