From 0e9cd1eea5ccc257838dd587261efed056d89deb Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 15 May 2023 08:57:11 -0700 Subject: [PATCH] Use specific work queue for quorum work The quorum work was using the system workq. While that's mostly fine, we can create a dedicated workqueue with the specific flags that we need. The quorum work needs to run promptly to avoid fencing so we set it to high priority. Signed-off-by: Zach Brown --- kmod/src/quorum.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/kmod/src/quorum.c b/kmod/src/quorum.c index d45c4f81..e64ae67f 100644 --- a/kmod/src/quorum.c +++ b/kmod/src/quorum.c @@ -115,6 +115,7 @@ struct quorum_status { struct quorum_info { struct super_block *sb; struct scoutfs_quorum_config qconf; + struct workqueue_struct *workq; struct work_struct work; struct socket *sock; bool shutdown; @@ -1195,6 +1196,15 @@ int scoutfs_quorum_setup(struct super_block *sb) sbi->quorum_info = qinf; qinf->sb = sb; + /* a high priority single threaded context without mem reclaim */ + qinf->workq = alloc_workqueue("scoutfs_quorum_work", + WQ_NON_REENTRANT | WQ_UNBOUND | + WQ_HIGHPRI, 1); + if (!qinf->workq) { + ret = -ENOMEM; + goto out; + } + ret = scoutfs_read_super(sb, super); if (ret < 0) goto out; @@ -1213,7 +1223,7 @@ int scoutfs_quorum_setup(struct super_block *sb) if (ret < 0) goto out; - schedule_work(&qinf->work); + queue_work(qinf->workq, &qinf->work); out: if (ret) @@ -1243,6 +1253,9 @@ void scoutfs_quorum_destroy(struct super_block *sb) qinf->shutdown = true; flush_work(&qinf->work); + if (qinf->workq) + destroy_workqueue(qinf->workq); + scoutfs_sysfs_destroy_attrs(sb, &qinf->ssa); if (qinf->sock) sock_release(qinf->sock);