scoutfs: unlock the server listen lock

Turns out the server wasn't explicitly unlocking the listen lock!  This
ended up working because we only shut down an active server on unmount
and unmount will tear down the lock space which will drop the still held
listen lock.

That's just dumb.

But it also forced using an awkward lock flag to avoid setting up a task
ref for the lock hold which wouldn't have been torn down otherwise.  By
adding the lock we restore balance to the force and can get rid of that
flag.

Cool, cool, cool.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-12-08 10:49:24 -08:00
committed by Mark Fasheh
parent c8f8feb7f8
commit ec91a4375f

View File

@@ -915,7 +915,7 @@ static void scoutfs_server_func(struct work_struct *work)
static struct sockaddr_in zeros = {0,};
struct socket *new_sock;
struct socket *sock = NULL;
struct scoutfs_lock *lock;
struct scoutfs_lock *lock = NULL;
struct server_connection *conn;
struct server_connection *conn_tmp;
struct pending_seq *ps;
@@ -930,7 +930,7 @@ static void scoutfs_server_func(struct work_struct *work)
init_waitqueue_head(&waitq);
ret = scoutfs_lock_global(sb, DLM_LOCK_EX,
SCOUTFS_LKF_TRYLOCK|SCOUTFS_LKF_NO_TASK_REF,
SCOUTFS_LKF_TRYLOCK,
SCOUTFS_LOCK_TYPE_GLOBAL_SERVER,
&lock);
if (ret)
@@ -1071,6 +1071,8 @@ out:
if (sock)
sock_release(sock);
scoutfs_unlock(sb, lock, DLM_LOCK_EX);
/* always requeues, cancel_delayed_work_sync cancels on shutdown */
queue_delayed_work(server->wq, &server->dwork, HZ / 2);
}