Skip to content

Commit 0f2b1cb

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: make F_SETLK use unkillable wait_event
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>
1 parent 59e45c7 commit 0f2b1cb

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

fs/dlm/plock.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,25 +155,29 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
155155

156156
send_op(op);
157157

158-
rv = wait_event_killable(recv_wq, (op->done != 0));
159-
if (rv == -ERESTARTSYS) {
160-
spin_lock(&ops_lock);
161-
/* recheck under ops_lock if we got a done != 0,
162-
* if so this interrupt case should be ignored
163-
*/
164-
if (op->done != 0) {
158+
if (op->info.wait) {
159+
rv = wait_event_killable(recv_wq, (op->done != 0));
160+
if (rv == -ERESTARTSYS) {
161+
spin_lock(&ops_lock);
162+
/* recheck under ops_lock if we got a done != 0,
163+
* if so this interrupt case should be ignored
164+
*/
165+
if (op->done != 0) {
166+
spin_unlock(&ops_lock);
167+
goto do_lock_wait;
168+
}
169+
list_del(&op->list);
165170
spin_unlock(&ops_lock);
166-
goto do_lock_wait;
167-
}
168-
list_del(&op->list);
169-
spin_unlock(&ops_lock);
170171

171-
log_debug(ls, "%s: wait interrupted %x %llx pid %d",
172-
__func__, ls->ls_global_id,
173-
(unsigned long long)number, op->info.pid);
174-
do_unlock_close(&op->info);
175-
dlm_release_plock_op(op);
176-
goto out;
172+
log_debug(ls, "%s: wait interrupted %x %llx pid %d",
173+
__func__, ls->ls_global_id,
174+
(unsigned long long)number, op->info.pid);
175+
do_unlock_close(&op->info);
176+
dlm_release_plock_op(op);
177+
goto out;
178+
}
179+
} else {
180+
wait_event(recv_wq, (op->done != 0));
177181
}
178182

179183
do_lock_wait:

0 commit comments

Comments
 (0)