fs: dlm: flush swork on shutdown
authorAlexander Aring <aahringo@redhat.com>
Mon, 1 Mar 2021 22:05:19 +0000 (17:05 -0500)
committerDavid Teigland <teigland@redhat.com>
Tue, 9 Mar 2021 14:56:42 +0000 (08:56 -0600)
This patch fixes the flushing of send work before shutdown. The function
cancel_work_sync() is not the right workqueue functionality to use here
as it would cancel the work if the work queues itself. In cases of
EAGAIN in send() for dlm message we need to be sure that everything is
send out before. The function flush_work() will ensure that every send
work is be done inclusive in EAGAIN cases.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/lowcomms.c

index a97c69ddbff0b387b3b03009d66b2418b2ef7f9c..43dad68e2387c4b4801be5f50ecfd6fbc29c20ca 100644 (file)
@@ -712,10 +712,7 @@ static void shutdown_connection(struct connection *con)
 {
        int ret;
 
-       if (cancel_work_sync(&con->swork)) {
-               log_print("canceled swork for node %d", con->nodeid);
-               clear_bit(CF_WRITE_PENDING, &con->flags);
-       }
+       flush_work(&con->swork);
 
        mutex_lock(&con->sock_mutex);
        /* nothing to shutdown */