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

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>

authored by

Jeff Layton and committed by
Christian Brauner
966b7bd3 3956f35f

+22 -23
+22 -23
fs/dlm/plock.c
··· 4 4 */ 5 5 6 6 #include <linux/fs.h> 7 - #define _NEED_FILE_LOCK_FIELD_MACROS 8 7 #include <linux/filelock.h> 9 8 #include <linux/miscdevice.h> 10 9 #include <linux/poll.h> ··· 138 139 } 139 140 140 141 op->info.optype = DLM_PLOCK_OP_LOCK; 141 - op->info.pid = fl->fl_pid; 142 - op->info.ex = (lock_is_write(fl)); 143 - op->info.wait = !!(fl->fl_flags & FL_SLEEP); 142 + op->info.pid = fl->c.flc_pid; 143 + op->info.ex = lock_is_write(fl); 144 + op->info.wait = !!(fl->c.flc_flags & FL_SLEEP); 144 145 op->info.fsid = ls->ls_global_id; 145 146 op->info.number = number; 146 147 op->info.start = fl->fl_start; 147 148 op->info.end = fl->fl_end; 148 - op->info.owner = (__u64)(long)fl->fl_owner; 149 + op->info.owner = (__u64)(long) fl->c.flc_owner; 149 150 /* async handling */ 150 151 if (fl->fl_lmops && fl->fl_lmops->lm_grant) { 151 152 op_data = kzalloc(sizeof(*op_data), GFP_NOFS); ··· 258 259 } 259 260 260 261 /* got fs lock; bookkeep locally as well: */ 261 - flc->fl_flags &= ~FL_SLEEP; 262 + flc->c.flc_flags &= ~FL_SLEEP; 262 263 if (posix_lock_file(file, flc, NULL)) { 263 264 /* 264 265 * This can only happen in the case of kmalloc() failure. ··· 291 292 struct dlm_ls *ls; 292 293 struct plock_op *op; 293 294 int rv; 294 - unsigned char saved_flags = fl->fl_flags; 295 + unsigned char saved_flags = fl->c.flc_flags; 295 296 296 297 ls = dlm_find_lockspace_local(lockspace); 297 298 if (!ls) ··· 304 305 } 305 306 306 307 /* cause the vfs unlock to return ENOENT if lock is not found */ 307 - fl->fl_flags |= FL_EXISTS; 308 + fl->c.flc_flags |= FL_EXISTS; 308 309 309 310 rv = locks_lock_file_wait(file, fl); 310 311 if (rv == -ENOENT) { ··· 317 318 } 318 319 319 320 op->info.optype = DLM_PLOCK_OP_UNLOCK; 320 - op->info.pid = fl->fl_pid; 321 + op->info.pid = fl->c.flc_pid; 321 322 op->info.fsid = ls->ls_global_id; 322 323 op->info.number = number; 323 324 op->info.start = fl->fl_start; 324 325 op->info.end = fl->fl_end; 325 - op->info.owner = (__u64)(long)fl->fl_owner; 326 + op->info.owner = (__u64)(long) fl->c.flc_owner; 326 327 327 - if (fl->fl_flags & FL_CLOSE) { 328 + if (fl->c.flc_flags & FL_CLOSE) { 328 329 op->info.flags |= DLM_PLOCK_FL_CLOSE; 329 330 send_op(op); 330 331 rv = 0; ··· 345 346 dlm_release_plock_op(op); 346 347 out: 347 348 dlm_put_lockspace(ls); 348 - fl->fl_flags = saved_flags; 349 + fl->c.flc_flags = saved_flags; 349 350 return rv; 350 351 } 351 352 EXPORT_SYMBOL_GPL(dlm_posix_unlock); ··· 375 376 return -EINVAL; 376 377 377 378 memset(&info, 0, sizeof(info)); 378 - info.pid = fl->fl_pid; 379 - info.ex = (lock_is_write(fl)); 379 + info.pid = fl->c.flc_pid; 380 + info.ex = lock_is_write(fl); 380 381 info.fsid = ls->ls_global_id; 381 382 dlm_put_lockspace(ls); 382 383 info.number = number; 383 384 info.start = fl->fl_start; 384 385 info.end = fl->fl_end; 385 - info.owner = (__u64)(long)fl->fl_owner; 386 + info.owner = (__u64)(long) fl->c.flc_owner; 386 387 387 388 rv = do_lock_cancel(&info); 388 389 switch (rv) { ··· 437 438 } 438 439 439 440 op->info.optype = DLM_PLOCK_OP_GET; 440 - op->info.pid = fl->fl_pid; 441 - op->info.ex = (lock_is_write(fl)); 441 + op->info.pid = fl->c.flc_pid; 442 + op->info.ex = lock_is_write(fl); 442 443 op->info.fsid = ls->ls_global_id; 443 444 op->info.number = number; 444 445 op->info.start = fl->fl_start; 445 446 op->info.end = fl->fl_end; 446 - op->info.owner = (__u64)(long)fl->fl_owner; 447 + op->info.owner = (__u64)(long) fl->c.flc_owner; 447 448 448 449 send_op(op); 449 450 wait_event(recv_wq, (op->done != 0)); ··· 455 456 456 457 rv = op->info.rv; 457 458 458 - fl->fl_type = F_UNLCK; 459 + fl->c.flc_type = F_UNLCK; 459 460 if (rv == -ENOENT) 460 461 rv = 0; 461 462 else if (rv > 0) { 462 463 locks_init_lock(fl); 463 - fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK; 464 - fl->fl_flags = FL_POSIX; 465 - fl->fl_pid = op->info.pid; 464 + fl->c.flc_type = (op->info.ex) ? F_WRLCK : F_RDLCK; 465 + fl->c.flc_flags = FL_POSIX; 466 + fl->c.flc_pid = op->info.pid; 466 467 if (op->info.nodeid != dlm_our_nodeid()) 467 - fl->fl_pid = -fl->fl_pid; 468 + fl->c.flc_pid = -fl->c.flc_pid; 468 469 fl->fl_start = op->info.start; 469 470 fl->fl_end = op->info.end; 470 471 rv = 0;