| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This copyrighted material is made available to anyone wishing to use, |
|---|
| 5 | | - * modify, copy, or redistribute it subject to the terms and conditions |
|---|
| 6 | | - * of the GNU General Public License version 2. |
|---|
| 7 | 4 | */ |
|---|
| 8 | 5 | |
|---|
| 9 | 6 | #include <linux/fs.h> |
|---|
| .. | .. |
|---|
| 26 | 23 | struct list_head list; |
|---|
| 27 | 24 | int done; |
|---|
| 28 | 25 | struct dlm_plock_info info; |
|---|
| 26 | + int (*callback)(struct file_lock *fl, int result); |
|---|
| 29 | 27 | }; |
|---|
| 30 | 28 | |
|---|
| 31 | 29 | struct plock_xop { |
|---|
| 32 | 30 | struct plock_op xop; |
|---|
| 33 | | - int (*callback)(struct file_lock *fl, int result); |
|---|
| 34 | 31 | void *fl; |
|---|
| 35 | 32 | void *file; |
|---|
| 36 | 33 | struct file_lock flc; |
|---|
| .. | .. |
|---|
| 132 | 129 | /* fl_owner is lockd which doesn't distinguish |
|---|
| 133 | 130 | processes on the nfs client */ |
|---|
| 134 | 131 | op->info.owner = (__u64) fl->fl_pid; |
|---|
| 135 | | - xop->callback = fl->fl_lmops->lm_grant; |
|---|
| 132 | + op->callback = fl->fl_lmops->lm_grant; |
|---|
| 136 | 133 | locks_init_lock(&xop->flc); |
|---|
| 137 | 134 | locks_copy_lock(&xop->flc, fl); |
|---|
| 138 | 135 | xop->fl = fl; |
|---|
| 139 | 136 | xop->file = file; |
|---|
| 140 | 137 | } else { |
|---|
| 141 | 138 | op->info.owner = (__u64)(long) fl->fl_owner; |
|---|
| 142 | | - xop->callback = NULL; |
|---|
| 143 | 139 | } |
|---|
| 144 | 140 | |
|---|
| 145 | 141 | send_op(op); |
|---|
| 146 | 142 | |
|---|
| 147 | | - if (xop->callback == NULL) { |
|---|
| 143 | + if (!op->callback) { |
|---|
| 148 | 144 | rv = wait_event_interruptible(recv_wq, (op->done != 0)); |
|---|
| 149 | 145 | if (rv == -ERESTARTSYS) { |
|---|
| 150 | 146 | log_debug(ls, "dlm_posix_lock: wait killed %llx", |
|---|
| .. | .. |
|---|
| 206 | 202 | file = xop->file; |
|---|
| 207 | 203 | flc = &xop->flc; |
|---|
| 208 | 204 | fl = xop->fl; |
|---|
| 209 | | - notify = xop->callback; |
|---|
| 205 | + notify = op->callback; |
|---|
| 210 | 206 | |
|---|
| 211 | 207 | if (op->info.rv) { |
|---|
| 212 | 208 | notify(fl, op->info.rv); |
|---|
| .. | .. |
|---|
| 439 | 435 | if (op->info.fsid == info.fsid && |
|---|
| 440 | 436 | op->info.number == info.number && |
|---|
| 441 | 437 | op->info.owner == info.owner) { |
|---|
| 442 | | - struct plock_xop *xop = (struct plock_xop *)op; |
|---|
| 443 | 438 | list_del_init(&op->list); |
|---|
| 444 | 439 | memcpy(&op->info, &info, sizeof(info)); |
|---|
| 445 | | - if (xop->callback) |
|---|
| 440 | + if (op->callback) |
|---|
| 446 | 441 | do_callback = 1; |
|---|
| 447 | 442 | else |
|---|
| 448 | 443 | op->done = 1; |
|---|