forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 958e46acc8e900e8569dd467c1af9b8d2d019394
kernel/fs/dlm/plock.c
....@@ -1,9 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * 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.
74 */
85
96 #include <linux/fs.h>
....@@ -26,11 +23,11 @@
2623 struct list_head list;
2724 int done;
2825 struct dlm_plock_info info;
26
+ int (*callback)(struct file_lock *fl, int result);
2927 };
3028
3129 struct plock_xop {
3230 struct plock_op xop;
33
- int (*callback)(struct file_lock *fl, int result);
3431 void *fl;
3532 void *file;
3633 struct file_lock flc;
....@@ -132,19 +129,18 @@
132129 /* fl_owner is lockd which doesn't distinguish
133130 processes on the nfs client */
134131 op->info.owner = (__u64) fl->fl_pid;
135
- xop->callback = fl->fl_lmops->lm_grant;
132
+ op->callback = fl->fl_lmops->lm_grant;
136133 locks_init_lock(&xop->flc);
137134 locks_copy_lock(&xop->flc, fl);
138135 xop->fl = fl;
139136 xop->file = file;
140137 } else {
141138 op->info.owner = (__u64)(long) fl->fl_owner;
142
- xop->callback = NULL;
143139 }
144140
145141 send_op(op);
146142
147
- if (xop->callback == NULL) {
143
+ if (!op->callback) {
148144 rv = wait_event_interruptible(recv_wq, (op->done != 0));
149145 if (rv == -ERESTARTSYS) {
150146 log_debug(ls, "dlm_posix_lock: wait killed %llx",
....@@ -206,7 +202,7 @@
206202 file = xop->file;
207203 flc = &xop->flc;
208204 fl = xop->fl;
209
- notify = xop->callback;
205
+ notify = op->callback;
210206
211207 if (op->info.rv) {
212208 notify(fl, op->info.rv);
....@@ -439,10 +435,9 @@
439435 if (op->info.fsid == info.fsid &&
440436 op->info.number == info.number &&
441437 op->info.owner == info.owner) {
442
- struct plock_xop *xop = (struct plock_xop *)op;
443438 list_del_init(&op->list);
444439 memcpy(&op->info, &info, sizeof(info));
445
- if (xop->callback)
440
+ if (op->callback)
446441 do_callback = 1;
447442 else
448443 op->done = 1;