From 384590f016dd77d1bc8dd2e24eb1125578c1dc7e Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 15 Jul 2021 09:26:22 -0700 Subject: [PATCH] Sync net shouldn't wait for errored submits If async network request submission fails then the response handler will never be called. The sync request wrapper made the mistake of trying to wait for completion when initial submission failed. This never happened in normal operation but we're able to trigger it with some regularity with forced unmount during tests. Unmount would hang waiting for work to shutdown which was waiting for request responses that would never happen. Signed-off-by: Zach Brown --- kmod/src/net.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kmod/src/net.c b/kmod/src/net.c index 593a62e7..00431f51 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -1801,11 +1801,13 @@ int scoutfs_net_sync_request(struct super_block *sb, ret = scoutfs_net_submit_request(sb, conn, cmd, arg, arg_len, sync_response, &sreq, &id); - ret = wait_for_completion_interruptible(&sreq.comp); - if (ret == -ERESTARTSYS) - scoutfs_net_cancel_request(sb, conn, cmd, id); - else - ret = sreq.error; + if (ret == 0) { + ret = wait_for_completion_interruptible(&sreq.comp); + if (ret == -ERESTARTSYS) + scoutfs_net_cancel_request(sb, conn, cmd, id); + else + ret = sreq.error; + } return ret; }