Skip to content

Commit 966b7bd

Browse files
jtlaytonbrauner
authored andcommitted
dlm: adapt to breakup of struct file_lock
Most of the existing APIs have remained the same, but subsystems that access file_lock fields directly need to reach into struct file_lock_core now. Signed-off-by: Jeff Layton <jlayton@kernel.org> Link: https://lore.kernel.org/r/20240131-flsplit-v3-37-c6129007ee8d@kernel.org Reviewed-by: NeilBrown <neilb@suse.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 3956f35 commit 966b7bd

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

fs/dlm/plock.c

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
#include <linux/fs.h>
7-
#define _NEED_FILE_LOCK_FIELD_MACROS
87
#include <linux/filelock.h>
98
#include <linux/miscdevice.h>
109
#include <linux/poll.h>
@@ -139,14 +138,14 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
139138
}
140139

141140
op->info.optype = DLM_PLOCK_OP_LOCK;
142-
op->info.pid = fl->fl_pid;
143-
op->info.ex = (lock_is_write(fl));
144-
op->info.wait = !!(fl->fl_flags & FL_SLEEP);
141+
op->info.pid = fl->c.flc_pid;
142+
op->info.ex = lock_is_write(fl);
143+
op->info.wait = !!(fl->c.flc_flags & FL_SLEEP);
145144
op->info.fsid = ls->ls_global_id;
146145
op->info.number = number;
147146
op->info.start = fl->fl_start;
148147
op->info.end = fl->fl_end;
149-
op->info.owner = (__u64)(long)fl->fl_owner;
148+
op->info.owner = (__u64)(long) fl->c.flc_owner;
150149
/* async handling */
151150
if (fl->fl_lmops && fl->fl_lmops->lm_grant) {
152151
op_data = kzalloc(sizeof(*op_data), GFP_NOFS);
@@ -259,7 +258,7 @@ static int dlm_plock_callback(struct plock_op *op)
259258
}
260259

261260
/* got fs lock; bookkeep locally as well: */
262-
flc->fl_flags &= ~FL_SLEEP;
261+
flc->c.flc_flags &= ~FL_SLEEP;
263262
if (posix_lock_file(file, flc, NULL)) {
264263
/*
265264
* This can only happen in the case of kmalloc() failure.
@@ -292,7 +291,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
292291
struct dlm_ls *ls;
293292
struct plock_op *op;
294293
int rv;
295-
unsigned char saved_flags = fl->fl_flags;
294+
unsigned char saved_flags = fl->c.flc_flags;
296295

297296
ls = dlm_find_lockspace_local(lockspace);
298297
if (!ls)
@@ -305,7 +304,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
305304
}
306305

307306
/* cause the vfs unlock to return ENOENT if lock is not found */
308-
fl->fl_flags |= FL_EXISTS;
307+
fl->c.flc_flags |= FL_EXISTS;
309308

310309
rv = locks_lock_file_wait(file, fl);
311310
if (rv == -ENOENT) {
@@ -318,14 +317,14 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
318317
}
319318

320319
op->info.optype = DLM_PLOCK_OP_UNLOCK;
321-
op->info.pid = fl->fl_pid;
320+
op->info.pid = fl->c.flc_pid;
322321
op->info.fsid = ls->ls_global_id;
323322
op->info.number = number;
324323
op->info.start = fl->fl_start;
325324
op->info.end = fl->fl_end;
326-
op->info.owner = (__u64)(long)fl->fl_owner;
325+
op->info.owner = (__u64)(long) fl->c.flc_owner;
327326

328-
if (fl->fl_flags & FL_CLOSE) {
327+
if (fl->c.flc_flags & FL_CLOSE) {
329328
op->info.flags |= DLM_PLOCK_FL_CLOSE;
330329
send_op(op);
331330
rv = 0;
@@ -346,7 +345,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
346345
dlm_release_plock_op(op);
347346
out:
348347
dlm_put_lockspace(ls);
349-
fl->fl_flags = saved_flags;
348+
fl->c.flc_flags = saved_flags;
350349
return rv;
351350
}
352351
EXPORT_SYMBOL_GPL(dlm_posix_unlock);
@@ -376,14 +375,14 @@ int dlm_posix_cancel(dlm_lockspace_t *lockspace, u64 number, struct file *file,
376375
return -EINVAL;
377376

378377
memset(&info, 0, sizeof(info));
379-
info.pid = fl->fl_pid;
380-
info.ex = (lock_is_write(fl));
378+
info.pid = fl->c.flc_pid;
379+
info.ex = lock_is_write(fl);
381380
info.fsid = ls->ls_global_id;
382381
dlm_put_lockspace(ls);
383382
info.number = number;
384383
info.start = fl->fl_start;
385384
info.end = fl->fl_end;
386-
info.owner = (__u64)(long)fl->fl_owner;
385+
info.owner = (__u64)(long) fl->c.flc_owner;
387386

388387
rv = do_lock_cancel(&info);
389388
switch (rv) {
@@ -438,13 +437,13 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
438437
}
439438

440439
op->info.optype = DLM_PLOCK_OP_GET;
441-
op->info.pid = fl->fl_pid;
442-
op->info.ex = (lock_is_write(fl));
440+
op->info.pid = fl->c.flc_pid;
441+
op->info.ex = lock_is_write(fl);
443442
op->info.fsid = ls->ls_global_id;
444443
op->info.number = number;
445444
op->info.start = fl->fl_start;
446445
op->info.end = fl->fl_end;
447-
op->info.owner = (__u64)(long)fl->fl_owner;
446+
op->info.owner = (__u64)(long) fl->c.flc_owner;
448447

449448
send_op(op);
450449
wait_event(recv_wq, (op->done != 0));
@@ -456,16 +455,16 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
456455

457456
rv = op->info.rv;
458457

459-
fl->fl_type = F_UNLCK;
458+
fl->c.flc_type = F_UNLCK;
460459
if (rv == -ENOENT)
461460
rv = 0;
462461
else if (rv > 0) {
463462
locks_init_lock(fl);
464-
fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK;
465-
fl->fl_flags = FL_POSIX;
466-
fl->fl_pid = op->info.pid;
463+
fl->c.flc_type = (op->info.ex) ? F_WRLCK : F_RDLCK;
464+
fl->c.flc_flags = FL_POSIX;
465+
fl->c.flc_pid = op->info.pid;
467466
if (op->info.nodeid != dlm_our_nodeid())
468-
fl->fl_pid = -fl->fl_pid;
467+
fl->c.flc_pid = -fl->c.flc_pid;
469468
fl->fl_start = op->info.start;
470469
fl->fl_end = op->info.end;
471470
rv = 0;

0 commit comments

Comments
 (0)