Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexander Aring and committed by
David Teigland
0f2b1cb8 59e45c75

+21 -17
+21 -17
fs/dlm/plock.c
··· 155 155 156 156 send_op(op); 157 157 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); 165 170 spin_unlock(&ops_lock); 166 - goto do_lock_wait; 167 - } 168 - list_del(&op->list); 169 - spin_unlock(&ops_lock); 170 171 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)); 177 181 } 178 182 179 183 do_lock_wait: