aboutsummaryrefslogtreecommitdiff
path: root/fs/dlm
diff options
context:
space:
mode:
authorAlexander Aring2023-05-19 11:21:27 -0400
committerGreg Kroah-Hartman2023-07-23 13:49:38 +0200
commitadeaef5a00dcfe023b0ecae3272ef0fd556efbaf (patch)
treeec9967e3ab94cd6f08602410122a034a166eaddc /fs/dlm
parent2a37d73395a51238a324a94b64bba734417ff2f8 (diff)
fs: dlm: make F_SETLK use unkillable wait_event
commit 0f2b1cb89ccdbdcedf7143f4153a4da700a05f48 upstream. While a non-waiting posix lock request (F_SETLK) is waiting for user space processing (in dlm_controld), wait for that processing to complete with an unkillable wait_event(). This makes F_SETLK behave the same way for F_RDLCK, F_WRLCK and F_UNLCK. F_SETLKW continues to use wait_event_killable(). Cc: stable@vger.kernel.org Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/plock.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index 7754d66ea9d8..0df24702125e 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -154,25 +154,29 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
send_op(op);
- rv = wait_event_killable(recv_wq, (op->done != 0));
- if (rv == -ERESTARTSYS) {
- spin_lock(&ops_lock);
- /* recheck under ops_lock if we got a done != 0,
- * if so this interrupt case should be ignored
- */
- if (op->done != 0) {
+ if (op->info.wait) {
+ rv = wait_event_killable(recv_wq, (op->done != 0));
+ if (rv == -ERESTARTSYS) {
+ spin_lock(&ops_lock);
+ /* recheck under ops_lock if we got a done != 0,
+ * if so this interrupt case should be ignored
+ */
+ if (op->done != 0) {
+ spin_unlock(&ops_lock);
+ goto do_lock_wait;
+ }
+ list_del(&op->list);
spin_unlock(&ops_lock);
- goto do_lock_wait;
- }
- list_del(&op->list);
- spin_unlock(&ops_lock);
- log_debug(ls, "%s: wait interrupted %x %llx pid %d",
- __func__, ls->ls_global_id,
- (unsigned long long)number, op->info.pid);
- do_unlock_close(&op->info);
- dlm_release_plock_op(op);
- goto out;
+ log_debug(ls, "%s: wait interrupted %x %llx pid %d",
+ __func__, ls->ls_global_id,
+ (unsigned long long)number, op->info.pid);
+ do_unlock_close(&op->info);
+ dlm_release_plock_op(op);
+ goto out;
+ }
+ } else {
+ wait_event(recv_wq, (op->done != 0));
}
do_lock_wait: