Skip to content

Commit c847f4e

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: fix cleanup pending ops when interrupted
Immediately clean up a posix lock request if it is interrupted while waiting for a result from user space (dlm_controld.) This largely reverts the recent commit b92a4e3 ("fs: dlm: change posix lock sigint handling"). That previous commit attempted to defer lock cleanup to the point in time when a result from user space arrived. The deferred approach was not reliable because some dlm plock ops may not receive replies. Cc: stable@vger.kernel.org Fixes: b92a4e3 ("fs: dlm: change posix lock sigint handling") Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 92655fb commit c847f4e

1 file changed

Lines changed: 6 additions & 19 deletions

File tree

fs/dlm/plock.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ struct plock_async_data {
3030
struct plock_op {
3131
struct list_head list;
3232
int done;
33-
/* if lock op got interrupted while waiting dlm_controld reply */
34-
bool sigint;
3533
struct dlm_plock_info info;
3634
/* if set indicates async handling */
3735
struct plock_async_data *data;
@@ -167,12 +165,14 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
167165
spin_unlock(&ops_lock);
168166
goto do_lock_wait;
169167
}
170-
171-
op->sigint = true;
168+
list_del(&op->list);
172169
spin_unlock(&ops_lock);
170+
173171
log_debug(ls, "%s: wait interrupted %x %llx pid %d",
174172
__func__, ls->ls_global_id,
175173
(unsigned long long)number, op->info.pid);
174+
do_unlock_close(&op->info);
175+
dlm_release_plock_op(op);
176176
goto out;
177177
}
178178

@@ -434,19 +434,6 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
434434
if (iter->info.fsid == info.fsid &&
435435
iter->info.number == info.number &&
436436
iter->info.owner == info.owner) {
437-
if (iter->sigint) {
438-
list_del(&iter->list);
439-
spin_unlock(&ops_lock);
440-
441-
pr_debug("%s: sigint cleanup %x %llx pid %d",
442-
__func__, iter->info.fsid,
443-
(unsigned long long)iter->info.number,
444-
iter->info.pid);
445-
do_unlock_close(&iter->info);
446-
memcpy(&iter->info, &info, sizeof(info));
447-
dlm_release_plock_op(iter);
448-
return count;
449-
}
450437
list_del_init(&iter->list);
451438
memcpy(&iter->info, &info, sizeof(info));
452439
if (iter->data)
@@ -465,8 +452,8 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
465452
else
466453
wake_up(&recv_wq);
467454
} else
468-
log_print("%s: no op %x %llx", __func__,
469-
info.fsid, (unsigned long long)info.number);
455+
pr_debug("%s: no op %x %llx", __func__,
456+
info.fsid, (unsigned long long)info.number);
470457
return count;
471458
}
472459

0 commit comments

Comments
 (0)