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

lockd: 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-40-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
eb8ed7c6 9a7eec48

+119 -114
+7 -7
fs/lockd/clnt4xdr.c
··· 243 243 u64 l_offset, l_len; 244 244 __be32 *p; 245 245 246 - encode_bool(xdr, lock->fl.fl_type == F_RDLCK); 246 + encode_bool(xdr, lock->fl.c.flc_type == F_RDLCK); 247 247 encode_int32(xdr, lock->svid); 248 248 encode_netobj(xdr, lock->oh.data, lock->oh.len); 249 249 ··· 270 270 goto out_overflow; 271 271 exclusive = be32_to_cpup(p++); 272 272 lock->svid = be32_to_cpup(p); 273 - fl->fl_pid = (pid_t)lock->svid; 273 + fl->c.flc_pid = (pid_t)lock->svid; 274 274 275 275 error = decode_netobj(xdr, &lock->oh); 276 276 if (unlikely(error)) ··· 280 280 if (unlikely(p == NULL)) 281 281 goto out_overflow; 282 282 283 - fl->fl_flags = FL_POSIX; 284 - fl->fl_type = exclusive != 0 ? F_WRLCK : F_RDLCK; 283 + fl->c.flc_flags = FL_POSIX; 284 + fl->c.flc_type = exclusive != 0 ? F_WRLCK : F_RDLCK; 285 285 p = xdr_decode_hyper(p, &l_offset); 286 286 xdr_decode_hyper(p, &l_len); 287 287 nlm4svc_set_file_lock_range(fl, l_offset, l_len); ··· 357 357 const struct nlm_lock *lock = &args->lock; 358 358 359 359 encode_cookie(xdr, &args->cookie); 360 - encode_bool(xdr, lock->fl.fl_type == F_WRLCK); 360 + encode_bool(xdr, lock->fl.c.flc_type == F_WRLCK); 361 361 encode_nlm4_lock(xdr, lock); 362 362 } 363 363 ··· 380 380 381 381 encode_cookie(xdr, &args->cookie); 382 382 encode_bool(xdr, args->block); 383 - encode_bool(xdr, lock->fl.fl_type == F_WRLCK); 383 + encode_bool(xdr, lock->fl.c.flc_type == F_WRLCK); 384 384 encode_nlm4_lock(xdr, lock); 385 385 encode_bool(xdr, args->reclaim); 386 386 encode_int32(xdr, args->state); ··· 403 403 404 404 encode_cookie(xdr, &args->cookie); 405 405 encode_bool(xdr, args->block); 406 - encode_bool(xdr, lock->fl.fl_type == F_WRLCK); 406 + encode_bool(xdr, lock->fl.c.flc_type == F_WRLCK); 407 407 encode_nlm4_lock(xdr, lock); 408 408 } 409 409
+1 -1
fs/lockd/clntlock.c
··· 185 185 continue; 186 186 if (!rpc_cmp_addr(nlm_addr(block->b_host), addr)) 187 187 continue; 188 - if (nfs_compare_fh(NFS_FH(file_inode(fl_blocked->fl_file)), fh) != 0) 188 + if (nfs_compare_fh(NFS_FH(file_inode(fl_blocked->c.flc_file)), fh) != 0) 189 189 continue; 190 190 /* Alright, we found a lock. Set the return status 191 191 * and wake up the caller
+33 -29
fs/lockd/clntproc.c
··· 12 12 #include <linux/types.h> 13 13 #include <linux/errno.h> 14 14 #include <linux/fs.h> 15 - #define _NEED_FILE_LOCK_FIELD_MACROS 16 15 #include <linux/filelock.h> 17 16 #include <linux/nfs_fs.h> 18 17 #include <linux/utsname.h> ··· 133 134 char *nodename = req->a_host->h_rpcclnt->cl_nodename; 134 135 135 136 nlmclnt_next_cookie(&argp->cookie); 136 - memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); 137 + memcpy(&lock->fh, NFS_FH(file_inode(fl->c.flc_file)), 138 + sizeof(struct nfs_fh)); 137 139 lock->caller = nodename; 138 140 lock->oh.data = req->a_owner; 139 141 lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", ··· 143 143 lock->svid = fl->fl_u.nfs_fl.owner->pid; 144 144 lock->fl.fl_start = fl->fl_start; 145 145 lock->fl.fl_end = fl->fl_end; 146 - lock->fl.fl_type = fl->fl_type; 146 + lock->fl.c.flc_type = fl->c.flc_type; 147 147 } 148 148 149 149 static void nlmclnt_release_lockargs(struct nlm_rqst *req) ··· 183 183 call->a_callback_data = data; 184 184 185 185 if (IS_SETLK(cmd) || IS_SETLKW(cmd)) { 186 - if (fl->fl_type != F_UNLCK) { 186 + if (fl->c.flc_type != F_UNLCK) { 187 187 call->a_args.block = IS_SETLKW(cmd) ? 1 : 0; 188 188 status = nlmclnt_lock(call, fl); 189 189 } else ··· 433 433 { 434 434 int status; 435 435 436 - status = nlmclnt_call(nfs_file_cred(fl->fl_file), req, NLMPROC_TEST); 436 + status = nlmclnt_call(nfs_file_cred(fl->c.flc_file), req, 437 + NLMPROC_TEST); 437 438 if (status < 0) 438 439 goto out; 439 440 440 441 switch (req->a_res.status) { 441 442 case nlm_granted: 442 - fl->fl_type = F_UNLCK; 443 + fl->c.flc_type = F_UNLCK; 443 444 break; 444 445 case nlm_lck_denied: 445 446 /* ··· 448 447 */ 449 448 fl->fl_start = req->a_res.lock.fl.fl_start; 450 449 fl->fl_end = req->a_res.lock.fl.fl_end; 451 - fl->fl_type = req->a_res.lock.fl.fl_type; 452 - fl->fl_pid = -req->a_res.lock.fl.fl_pid; 450 + fl->c.flc_type = req->a_res.lock.fl.c.flc_type; 451 + fl->c.flc_pid = -req->a_res.lock.fl.c.flc_pid; 453 452 break; 454 453 default: 455 454 status = nlm_stat_to_errno(req->a_res.status); ··· 487 486 static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host) 488 487 { 489 488 fl->fl_u.nfs_fl.state = 0; 490 - fl->fl_u.nfs_fl.owner = nlmclnt_find_lockowner(host, fl->fl_owner); 489 + fl->fl_u.nfs_fl.owner = nlmclnt_find_lockowner(host, 490 + fl->c.flc_owner); 491 491 INIT_LIST_HEAD(&fl->fl_u.nfs_fl.list); 492 492 fl->fl_ops = &nlmclnt_lock_ops; 493 493 } 494 494 495 495 static int do_vfs_lock(struct file_lock *fl) 496 496 { 497 - return locks_lock_file_wait(fl->fl_file, fl); 497 + return locks_lock_file_wait(fl->c.flc_file, fl); 498 498 } 499 499 500 500 /* ··· 521 519 static int 522 520 nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl) 523 521 { 524 - const struct cred *cred = nfs_file_cred(fl->fl_file); 522 + const struct cred *cred = nfs_file_cred(fl->c.flc_file); 525 523 struct nlm_host *host = req->a_host; 526 524 struct nlm_res *resp = &req->a_res; 527 525 struct nlm_wait block; 528 - unsigned char flags = fl->fl_flags; 526 + unsigned char flags = fl->c.flc_flags; 529 527 unsigned char type; 530 528 __be32 b_status; 531 529 int status = -ENOLCK; ··· 534 532 goto out; 535 533 req->a_args.state = nsm_local_state; 536 534 537 - fl->fl_flags |= FL_ACCESS; 535 + fl->c.flc_flags |= FL_ACCESS; 538 536 status = do_vfs_lock(fl); 539 - fl->fl_flags = flags; 537 + fl->c.flc_flags = flags; 540 538 if (status < 0) 541 539 goto out; 542 540 ··· 594 592 goto again; 595 593 } 596 594 /* Ensure the resulting lock will get added to granted list */ 597 - fl->fl_flags |= FL_SLEEP; 595 + fl->c.flc_flags |= FL_SLEEP; 598 596 if (do_vfs_lock(fl) < 0) 599 597 printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", __func__); 600 598 up_read(&host->h_rwsem); 601 - fl->fl_flags = flags; 599 + fl->c.flc_flags = flags; 602 600 status = 0; 603 601 } 604 602 if (status < 0) ··· 625 623 req->a_host->h_addrlen, req->a_res.status); 626 624 dprintk("lockd: lock attempt ended in fatal error.\n" 627 625 " Attempting to unlock.\n"); 628 - type = fl->fl_type; 629 - fl->fl_type = F_UNLCK; 626 + type = fl->c.flc_type; 627 + fl->c.flc_type = F_UNLCK; 630 628 down_read(&host->h_rwsem); 631 629 do_vfs_lock(fl); 632 630 up_read(&host->h_rwsem); 633 - fl->fl_type = type; 634 - fl->fl_flags = flags; 631 + fl->c.flc_type = type; 632 + fl->c.flc_flags = flags; 635 633 nlmclnt_async_call(cred, req, NLMPROC_UNLOCK, &nlmclnt_unlock_ops); 636 634 return status; 637 635 } ··· 654 652 nlmclnt_setlockargs(req, fl); 655 653 req->a_args.reclaim = 1; 656 654 657 - status = nlmclnt_call(nfs_file_cred(fl->fl_file), req, NLMPROC_LOCK); 655 + status = nlmclnt_call(nfs_file_cred(fl->c.flc_file), req, 656 + NLMPROC_LOCK); 658 657 if (status >= 0 && req->a_res.status == nlm_granted) 659 658 return 0; 660 659 661 660 printk(KERN_WARNING "lockd: failed to reclaim lock for pid %d " 662 - "(errno %d, status %d)\n", fl->fl_pid, 661 + "(errno %d, status %d)\n", 662 + fl->c.flc_pid, 663 663 status, ntohl(req->a_res.status)); 664 664 665 665 /* ··· 688 684 struct nlm_host *host = req->a_host; 689 685 struct nlm_res *resp = &req->a_res; 690 686 int status; 691 - unsigned char flags = fl->fl_flags; 687 + unsigned char flags = fl->c.flc_flags; 692 688 693 689 /* 694 690 * Note: the server is supposed to either grant us the unlock 695 691 * request, or to deny it with NLM_LCK_DENIED_GRACE_PERIOD. In either 696 692 * case, we want to unlock. 697 693 */ 698 - fl->fl_flags |= FL_EXISTS; 694 + fl->c.flc_flags |= FL_EXISTS; 699 695 down_read(&host->h_rwsem); 700 696 status = do_vfs_lock(fl); 701 697 up_read(&host->h_rwsem); 702 - fl->fl_flags = flags; 698 + fl->c.flc_flags = flags; 703 699 if (status == -ENOENT) { 704 700 status = 0; 705 701 goto out; 706 702 } 707 703 708 704 refcount_inc(&req->a_count); 709 - status = nlmclnt_async_call(nfs_file_cred(fl->fl_file), req, 710 - NLMPROC_UNLOCK, &nlmclnt_unlock_ops); 705 + status = nlmclnt_async_call(nfs_file_cred(fl->c.flc_file), req, 706 + NLMPROC_UNLOCK, &nlmclnt_unlock_ops); 711 707 if (status < 0) 712 708 goto out; 713 709 ··· 800 796 req->a_args.block = block; 801 797 802 798 refcount_inc(&req->a_count); 803 - status = nlmclnt_async_call(nfs_file_cred(fl->fl_file), req, 804 - NLMPROC_CANCEL, &nlmclnt_cancel_ops); 799 + status = nlmclnt_async_call(nfs_file_cred(fl->c.flc_file), req, 800 + NLMPROC_CANCEL, &nlmclnt_cancel_ops); 805 801 if (status == 0 && req->a_res.status == nlm_lck_denied) 806 802 status = -ENOLCK; 807 803 nlmclnt_release_call(req);
+7 -7
fs/lockd/clntxdr.c
··· 238 238 u32 l_offset, l_len; 239 239 __be32 *p; 240 240 241 - encode_bool(xdr, lock->fl.fl_type == F_RDLCK); 241 + encode_bool(xdr, lock->fl.c.flc_type == F_RDLCK); 242 242 encode_int32(xdr, lock->svid); 243 243 encode_netobj(xdr, lock->oh.data, lock->oh.len); 244 244 ··· 265 265 goto out_overflow; 266 266 exclusive = be32_to_cpup(p++); 267 267 lock->svid = be32_to_cpup(p); 268 - fl->fl_pid = (pid_t)lock->svid; 268 + fl->c.flc_pid = (pid_t)lock->svid; 269 269 270 270 error = decode_netobj(xdr, &lock->oh); 271 271 if (unlikely(error)) ··· 275 275 if (unlikely(p == NULL)) 276 276 goto out_overflow; 277 277 278 - fl->fl_flags = FL_POSIX; 279 - fl->fl_type = exclusive != 0 ? F_WRLCK : F_RDLCK; 278 + fl->c.flc_flags = FL_POSIX; 279 + fl->c.flc_type = exclusive != 0 ? F_WRLCK : F_RDLCK; 280 280 l_offset = be32_to_cpup(p++); 281 281 l_len = be32_to_cpup(p); 282 282 end = l_offset + l_len - 1; ··· 357 357 const struct nlm_lock *lock = &args->lock; 358 358 359 359 encode_cookie(xdr, &args->cookie); 360 - encode_bool(xdr, lock->fl.fl_type == F_WRLCK); 360 + encode_bool(xdr, lock->fl.c.flc_type == F_WRLCK); 361 361 encode_nlm_lock(xdr, lock); 362 362 } 363 363 ··· 380 380 381 381 encode_cookie(xdr, &args->cookie); 382 382 encode_bool(xdr, args->block); 383 - encode_bool(xdr, lock->fl.fl_type == F_WRLCK); 383 + encode_bool(xdr, lock->fl.c.flc_type == F_WRLCK); 384 384 encode_nlm_lock(xdr, lock); 385 385 encode_bool(xdr, args->reclaim); 386 386 encode_int32(xdr, args->state); ··· 403 403 404 404 encode_cookie(xdr, &args->cookie); 405 405 encode_bool(xdr, args->block); 406 - encode_bool(xdr, lock->fl.fl_type == F_WRLCK); 406 + encode_bool(xdr, lock->fl.c.flc_type == F_WRLCK); 407 407 encode_nlm_lock(xdr, lock); 408 408 } 409 409
+5 -5
fs/lockd/svc4proc.c
··· 52 52 *filp = file; 53 53 54 54 /* Set up the missing parts of the file_lock structure */ 55 - lock->fl.fl_flags = FL_POSIX; 56 - lock->fl.fl_file = file->f_file[mode]; 57 - lock->fl.fl_pid = current->tgid; 55 + lock->fl.c.flc_flags = FL_POSIX; 56 + lock->fl.c.flc_file = file->f_file[mode]; 57 + lock->fl.c.flc_pid = current->tgid; 58 58 lock->fl.fl_start = (loff_t)lock->lock_start; 59 59 lock->fl.fl_end = lock->lock_len ? 60 60 (loff_t)(lock->lock_start + lock->lock_len - 1) : 61 61 OFFSET_MAX; 62 62 lock->fl.fl_lmops = &nlmsvc_lock_operations; 63 63 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); 64 - if (!lock->fl.fl_owner) { 64 + if (!lock->fl.c.flc_owner) { 65 65 /* lockowner allocation has failed */ 66 66 nlmsvc_release_host(host); 67 67 return nlm_lck_denied_nolocks; ··· 106 106 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 107 107 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 108 108 109 - test_owner = argp->lock.fl.fl_owner; 109 + test_owner = argp->lock.fl.c.flc_owner; 110 110 /* Now check for conflicting locks */ 111 111 resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie); 112 112 if (resp->status == nlm_drop_reply)
+33 -31
fs/lockd/svclock.c
··· 150 150 struct file_lock *fl; 151 151 152 152 dprintk("lockd: nlmsvc_lookup_block f=%p pd=%d %Ld-%Ld ty=%d\n", 153 - file, lock->fl.fl_pid, 153 + file, lock->fl.c.flc_pid, 154 154 (long long)lock->fl.fl_start, 155 - (long long)lock->fl.fl_end, lock->fl.fl_type); 155 + (long long)lock->fl.fl_end, 156 + lock->fl.c.flc_type); 156 157 spin_lock(&nlm_blocked_lock); 157 158 list_for_each_entry(block, &nlm_blocked, b_list) { 158 159 fl = &block->b_call->a_args.lock.fl; 159 160 dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n", 160 - block->b_file, fl->fl_pid, 161 + block->b_file, fl->c.flc_pid, 161 162 (long long)fl->fl_start, 162 - (long long)fl->fl_end, fl->fl_type, 163 + (long long)fl->fl_end, fl->c.flc_type, 163 164 nlmdbg_cookie2a(&block->b_call->a_args.cookie)); 164 165 if (block->b_file == file && nlm_compare_locks(fl, &lock->fl)) { 165 166 kref_get(&block->b_count); ··· 245 244 goto failed_free; 246 245 247 246 /* Set notifier function for VFS, and init args */ 248 - call->a_args.lock.fl.fl_flags |= FL_SLEEP; 247 + call->a_args.lock.fl.c.flc_flags |= FL_SLEEP; 249 248 call->a_args.lock.fl.fl_lmops = &nlmsvc_lock_operations; 250 249 nlmclnt_next_cookie(&call->a_args.cookie); 251 250 ··· 403 402 void 404 403 nlmsvc_release_lockowner(struct nlm_lock *lock) 405 404 { 406 - if (lock->fl.fl_owner) 407 - nlmsvc_put_lockowner(lock->fl.fl_owner); 405 + if (lock->fl.c.flc_owner) 406 + nlmsvc_put_lockowner(lock->fl.c.flc_owner); 408 407 } 409 408 410 409 void nlmsvc_locks_init_private(struct file_lock *fl, struct nlm_host *host, 411 410 pid_t pid) 412 411 { 413 - fl->fl_owner = nlmsvc_find_lockowner(host, pid); 412 + fl->c.flc_owner = nlmsvc_find_lockowner(host, pid); 414 413 } 415 414 416 415 /* ··· 426 425 427 426 /* set default data area */ 428 427 call->a_args.lock.oh.data = call->a_owner; 429 - call->a_args.lock.svid = ((struct nlm_lockowner *)lock->fl.fl_owner)->pid; 428 + call->a_args.lock.svid = ((struct nlm_lockowner *) lock->fl.c.flc_owner)->pid; 430 429 431 430 if (lock->oh.len > NLMCLNT_OHSIZE) { 432 431 void *data = kmalloc(lock->oh.len, GFP_KERNEL); ··· 490 489 491 490 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", 492 491 inode->i_sb->s_id, inode->i_ino, 493 - lock->fl.fl_type, lock->fl.fl_pid, 492 + lock->fl.c.flc_type, 493 + lock->fl.c.flc_pid, 494 494 (long long)lock->fl.fl_start, 495 495 (long long)lock->fl.fl_end, 496 496 wait); ··· 514 512 goto out; 515 513 lock = &block->b_call->a_args.lock; 516 514 } else 517 - lock->fl.fl_flags &= ~FL_SLEEP; 515 + lock->fl.c.flc_flags &= ~FL_SLEEP; 518 516 519 517 if (block->b_flags & B_QUEUED) { 520 518 dprintk("lockd: nlmsvc_lock deferred block %p flags %d\n", ··· 562 560 spin_unlock(&nlm_blocked_lock); 563 561 564 562 if (!wait) 565 - lock->fl.fl_flags &= ~FL_SLEEP; 563 + lock->fl.c.flc_flags &= ~FL_SLEEP; 566 564 mode = lock_to_openmode(&lock->fl); 567 565 error = vfs_lock_file(file->f_file[mode], F_SETLK, &lock->fl, NULL); 568 - lock->fl.fl_flags &= ~FL_SLEEP; 566 + lock->fl.c.flc_flags &= ~FL_SLEEP; 569 567 570 568 dprintk("lockd: vfs_lock_file returned %d\n", error); 571 569 switch (error) { ··· 618 616 dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n", 619 617 nlmsvc_file_inode(file)->i_sb->s_id, 620 618 nlmsvc_file_inode(file)->i_ino, 621 - lock->fl.fl_type, 619 + lock->fl.c.flc_type, 622 620 (long long)lock->fl.fl_start, 623 621 (long long)lock->fl.fl_end); 624 622 ··· 638 636 goto out; 639 637 } 640 638 641 - if (lock->fl.fl_type == F_UNLCK) { 639 + if (lock->fl.c.flc_type == F_UNLCK) { 642 640 ret = nlm_granted; 643 641 goto out; 644 642 } 645 643 646 644 dprintk("lockd: conflicting lock(ty=%d, %Ld-%Ld)\n", 647 - lock->fl.fl_type, (long long)lock->fl.fl_start, 645 + lock->fl.c.flc_type, (long long)lock->fl.fl_start, 648 646 (long long)lock->fl.fl_end); 649 647 conflock->caller = "somehost"; /* FIXME */ 650 648 conflock->len = strlen(conflock->caller); 651 649 conflock->oh.len = 0; /* don't return OH info */ 652 - conflock->svid = lock->fl.fl_pid; 653 - conflock->fl.fl_type = lock->fl.fl_type; 650 + conflock->svid = lock->fl.c.flc_pid; 651 + conflock->fl.c.flc_type = lock->fl.c.flc_type; 654 652 conflock->fl.fl_start = lock->fl.fl_start; 655 653 conflock->fl.fl_end = lock->fl.fl_end; 656 654 locks_release_private(&lock->fl); ··· 675 673 dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n", 676 674 nlmsvc_file_inode(file)->i_sb->s_id, 677 675 nlmsvc_file_inode(file)->i_ino, 678 - lock->fl.fl_pid, 676 + lock->fl.c.flc_pid, 679 677 (long long)lock->fl.fl_start, 680 678 (long long)lock->fl.fl_end); 681 679 682 680 /* First, cancel any lock that might be there */ 683 681 nlmsvc_cancel_blocked(net, file, lock); 684 682 685 - lock->fl.fl_type = F_UNLCK; 686 - lock->fl.fl_file = file->f_file[O_RDONLY]; 687 - if (lock->fl.fl_file) 688 - error = vfs_lock_file(lock->fl.fl_file, F_SETLK, 683 + lock->fl.c.flc_type = F_UNLCK; 684 + lock->fl.c.flc_file = file->f_file[O_RDONLY]; 685 + if (lock->fl.c.flc_file) 686 + error = vfs_lock_file(lock->fl.c.flc_file, F_SETLK, 689 687 &lock->fl, NULL); 690 - lock->fl.fl_file = file->f_file[O_WRONLY]; 691 - if (lock->fl.fl_file) 692 - error |= vfs_lock_file(lock->fl.fl_file, F_SETLK, 688 + lock->fl.c.flc_file = file->f_file[O_WRONLY]; 689 + if (lock->fl.c.flc_file) 690 + error |= vfs_lock_file(lock->fl.c.flc_file, F_SETLK, 693 691 &lock->fl, NULL); 694 692 695 693 return (error < 0)? nlm_lck_denied_nolocks : nlm_granted; ··· 712 710 dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", 713 711 nlmsvc_file_inode(file)->i_sb->s_id, 714 712 nlmsvc_file_inode(file)->i_ino, 715 - lock->fl.fl_pid, 713 + lock->fl.c.flc_pid, 716 714 (long long)lock->fl.fl_start, 717 715 (long long)lock->fl.fl_end); 718 716 ··· 865 863 /* vfs_lock_file() can mangle fl_start and fl_end, but we need 866 864 * them unchanged for the GRANT_MSG 867 865 */ 868 - lock->fl.fl_flags |= FL_SLEEP; 866 + lock->fl.c.flc_flags |= FL_SLEEP; 869 867 fl_start = lock->fl.fl_start; 870 868 fl_end = lock->fl.fl_end; 871 869 mode = lock_to_openmode(&lock->fl); 872 870 error = vfs_lock_file(file->f_file[mode], F_SETLK, &lock->fl, NULL); 873 - lock->fl.fl_flags &= ~FL_SLEEP; 871 + lock->fl.c.flc_flags &= ~FL_SLEEP; 874 872 lock->fl.fl_start = fl_start; 875 873 lock->fl.fl_end = fl_end; 876 874 ··· 995 993 /* Client doesn't want it, just unlock it */ 996 994 nlmsvc_unlink_block(block); 997 995 fl = &block->b_call->a_args.lock.fl; 998 - fl->fl_type = F_UNLCK; 999 - error = vfs_lock_file(fl->fl_file, F_SETLK, fl, NULL); 996 + fl->c.flc_type = F_UNLCK; 997 + error = vfs_lock_file(fl->c.flc_file, F_SETLK, fl, NULL); 1000 998 if (error) 1001 999 pr_warn("lockd: unable to unlock lock rejected by client!\n"); 1002 1000 break;
+5 -5
fs/lockd/svcproc.c
··· 77 77 78 78 /* Set up the missing parts of the file_lock structure */ 79 79 mode = lock_to_openmode(&lock->fl); 80 - lock->fl.fl_flags = FL_POSIX; 81 - lock->fl.fl_file = file->f_file[mode]; 82 - lock->fl.fl_pid = current->tgid; 80 + lock->fl.c.flc_flags = FL_POSIX; 81 + lock->fl.c.flc_file = file->f_file[mode]; 82 + lock->fl.c.flc_pid = current->tgid; 83 83 lock->fl.fl_lmops = &nlmsvc_lock_operations; 84 84 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); 85 - if (!lock->fl.fl_owner) { 85 + if (!lock->fl.c.flc_owner) { 86 86 /* lockowner allocation has failed */ 87 87 nlmsvc_release_host(host); 88 88 return nlm_lck_denied_nolocks; ··· 127 127 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 128 128 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 129 129 130 - test_owner = argp->lock.fl.fl_owner; 130 + test_owner = argp->lock.fl.c.flc_owner; 131 131 132 132 /* Now check for conflicting locks */ 133 133 resp->status = cast_status(nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie));
+10 -10
fs/lockd/svcsubs.c
··· 73 73 74 74 int lock_to_openmode(struct file_lock *lock) 75 75 { 76 - return (lock_is_write(lock)) ? O_WRONLY : O_RDONLY; 76 + return lock_is_write(lock) ? O_WRONLY : O_RDONLY; 77 77 } 78 78 79 79 /* ··· 181 181 struct file_lock lock; 182 182 183 183 locks_init_lock(&lock); 184 - lock.fl_type = F_UNLCK; 184 + lock.c.flc_type = F_UNLCK; 185 185 lock.fl_start = 0; 186 186 lock.fl_end = OFFSET_MAX; 187 - lock.fl_owner = fl->fl_owner; 188 - lock.fl_pid = fl->fl_pid; 189 - lock.fl_flags = FL_POSIX; 187 + lock.c.flc_owner = fl->c.flc_owner; 188 + lock.c.flc_pid = fl->c.flc_pid; 189 + lock.c.flc_flags = FL_POSIX; 190 190 191 - lock.fl_file = file->f_file[O_RDONLY]; 192 - if (lock.fl_file && vfs_lock_file(lock.fl_file, F_SETLK, &lock, NULL)) 191 + lock.c.flc_file = file->f_file[O_RDONLY]; 192 + if (lock.c.flc_file && vfs_lock_file(lock.c.flc_file, F_SETLK, &lock, NULL)) 193 193 goto out_err; 194 - lock.fl_file = file->f_file[O_WRONLY]; 195 - if (lock.fl_file && vfs_lock_file(lock.fl_file, F_SETLK, &lock, NULL)) 194 + lock.c.flc_file = file->f_file[O_WRONLY]; 195 + if (lock.c.flc_file && vfs_lock_file(lock.c.flc_file, F_SETLK, &lock, NULL)) 196 196 goto out_err; 197 197 return 0; 198 198 out_err: ··· 225 225 /* update current lock count */ 226 226 file->f_locks++; 227 227 228 - lockhost = ((struct nlm_lockowner *)fl->fl_owner)->host; 228 + lockhost = ((struct nlm_lockowner *) fl->c.flc_owner)->host; 229 229 if (match(lockhost, host)) { 230 230 231 231 spin_unlock(&flctx->flc_lock);
+7 -7
fs/lockd/xdr.c
··· 88 88 return false; 89 89 90 90 locks_init_lock(fl); 91 - fl->fl_flags = FL_POSIX; 92 - fl->fl_type = F_RDLCK; 91 + fl->c.flc_flags = FL_POSIX; 92 + fl->c.flc_type = F_RDLCK; 93 93 end = start + len - 1; 94 94 fl->fl_start = s32_to_loff_t(start); 95 95 if (len == 0 || end < 0) ··· 107 107 s32 start, len; 108 108 109 109 /* exclusive */ 110 - if (xdr_stream_encode_bool(xdr, fl->fl_type != F_RDLCK) < 0) 110 + if (xdr_stream_encode_bool(xdr, fl->c.flc_type != F_RDLCK) < 0) 111 111 return false; 112 112 if (xdr_stream_encode_u32(xdr, lock->svid) < 0) 113 113 return false; ··· 164 164 if (!svcxdr_decode_lock(xdr, &argp->lock)) 165 165 return false; 166 166 if (exclusive) 167 - argp->lock.fl.fl_type = F_WRLCK; 167 + argp->lock.fl.c.flc_type = F_WRLCK; 168 168 169 169 return true; 170 170 } ··· 184 184 if (!svcxdr_decode_lock(xdr, &argp->lock)) 185 185 return false; 186 186 if (exclusive) 187 - argp->lock.fl.fl_type = F_WRLCK; 187 + argp->lock.fl.c.flc_type = F_WRLCK; 188 188 if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0) 189 189 return false; 190 190 if (xdr_stream_decode_u32(xdr, &argp->state) < 0) ··· 209 209 if (!svcxdr_decode_lock(xdr, &argp->lock)) 210 210 return false; 211 211 if (exclusive) 212 - argp->lock.fl.fl_type = F_WRLCK; 212 + argp->lock.fl.c.flc_type = F_WRLCK; 213 213 214 214 return true; 215 215 } ··· 223 223 return false; 224 224 if (!svcxdr_decode_lock(xdr, &argp->lock)) 225 225 return false; 226 - argp->lock.fl.fl_type = F_UNLCK; 226 + argp->lock.fl.c.flc_type = F_UNLCK; 227 227 228 228 return true; 229 229 }
+7 -7
fs/lockd/xdr4.c
··· 89 89 return false; 90 90 91 91 locks_init_lock(fl); 92 - fl->fl_flags = FL_POSIX; 93 - fl->fl_type = F_RDLCK; 92 + fl->c.flc_flags = FL_POSIX; 93 + fl->c.flc_type = F_RDLCK; 94 94 nlm4svc_set_file_lock_range(fl, lock->lock_start, lock->lock_len); 95 95 return true; 96 96 } ··· 102 102 s64 start, len; 103 103 104 104 /* exclusive */ 105 - if (xdr_stream_encode_bool(xdr, fl->fl_type != F_RDLCK) < 0) 105 + if (xdr_stream_encode_bool(xdr, fl->c.flc_type != F_RDLCK) < 0) 106 106 return false; 107 107 if (xdr_stream_encode_u32(xdr, lock->svid) < 0) 108 108 return false; ··· 159 159 if (!svcxdr_decode_lock(xdr, &argp->lock)) 160 160 return false; 161 161 if (exclusive) 162 - argp->lock.fl.fl_type = F_WRLCK; 162 + argp->lock.fl.c.flc_type = F_WRLCK; 163 163 164 164 return true; 165 165 } ··· 179 179 if (!svcxdr_decode_lock(xdr, &argp->lock)) 180 180 return false; 181 181 if (exclusive) 182 - argp->lock.fl.fl_type = F_WRLCK; 182 + argp->lock.fl.c.flc_type = F_WRLCK; 183 183 if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0) 184 184 return false; 185 185 if (xdr_stream_decode_u32(xdr, &argp->state) < 0) ··· 204 204 if (!svcxdr_decode_lock(xdr, &argp->lock)) 205 205 return false; 206 206 if (exclusive) 207 - argp->lock.fl.fl_type = F_WRLCK; 207 + argp->lock.fl.c.flc_type = F_WRLCK; 208 208 209 209 return true; 210 210 } ··· 218 218 return false; 219 219 if (!svcxdr_decode_lock(xdr, &argp->lock)) 220 220 return false; 221 - argp->lock.fl.fl_type = F_UNLCK; 221 + argp->lock.fl.c.flc_type = F_UNLCK; 222 222 223 223 return true; 224 224 }
+4 -4
include/linux/lockd/lockd.h
··· 375 375 static inline int nlm_compare_locks(const struct file_lock *fl1, 376 376 const struct file_lock *fl2) 377 377 { 378 - return file_inode(fl1->fl_file) == file_inode(fl2->fl_file) 379 - && fl1->fl_pid == fl2->fl_pid 380 - && fl1->fl_owner == fl2->fl_owner 378 + return file_inode(fl1->c.flc_file) == file_inode(fl2->c.flc_file) 379 + && fl1->c.flc_pid == fl2->c.flc_pid 380 + && fl1->c.flc_owner == fl2->c.flc_owner 381 381 && fl1->fl_start == fl2->fl_start 382 382 && fl1->fl_end == fl2->fl_end 383 - &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK); 383 + &&(fl1->c.flc_type == fl2->c.flc_type || fl2->c.flc_type == F_UNLCK); 384 384 } 385 385 386 386 extern const struct lock_manager_operations nlmsvc_lock_operations;
-1
include/linux/lockd/xdr.h
··· 11 11 #define LOCKD_XDR_H 12 12 13 13 #include <linux/fs.h> 14 - #define _NEED_FILE_LOCK_FIELD_MACROS 15 14 #include <linux/filelock.h> 16 15 #include <linux/nfs.h> 17 16 #include <linux/sunrpc/xdr.h>