Skip to content

Commit 9df7b5e

Browse files
dhowellsbrauner
authored andcommitted
netfs: Fix double put of request
If a netfs request finishes during the pause loop, it will have the ref that belongs to the IN_PROGRESS flag removed at that point - however, if it then goes to the final wait loop, that will *also* put the ref because it sees that the IN_PROGRESS flag is clear and incorrectly assumes that this happened when it called the collector. In fact, since IN_PROGRESS is clear, we shouldn't call the collector again since it's done all the cleanup, such as calling ->ki_complete(). Fix this by making netfs_collect_in_app() just return, indicating that we're done if IN_PROGRESS is removed. Fixes: 2b1424c ("netfs: Fix wait/wake to be consistent about the waitqueue used") Signed-off-by: David Howells <[email protected]> Link: https://lore.kernel.org/[email protected] Tested-by: Steve French <[email protected]> Reviewed-by: Paulo Alcantara <[email protected]> cc: Steve French <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent da8cf4b commit 9df7b5e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

fs/netfs/misc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,11 @@ static int netfs_collect_in_app(struct netfs_io_request *rreq,
383383
{
384384
bool need_collect = false, inactive = true, done = true;
385385

386+
if (!netfs_check_rreq_in_progress(rreq)) {
387+
trace_netfs_rreq(rreq, netfs_rreq_trace_recollect);
388+
return 1; /* Done */
389+
}
390+
386391
for (int i = 0; i < NR_IO_STREAMS; i++) {
387392
struct netfs_io_subrequest *subreq;
388393
struct netfs_io_stream *stream = &rreq->io_streams[i];

include/trace/events/netfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
EM(netfs_rreq_trace_dirty, "DIRTY ") \
5757
EM(netfs_rreq_trace_done, "DONE ") \
5858
EM(netfs_rreq_trace_free, "FREE ") \
59+
EM(netfs_rreq_trace_recollect, "RECLLCT") \
5960
EM(netfs_rreq_trace_redirty, "REDIRTY") \
6061
EM(netfs_rreq_trace_resubmit, "RESUBMT") \
6162
EM(netfs_rreq_trace_set_abandon, "S-ABNDN") \

0 commit comments

Comments
 (0)