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

locks: Cleanup lm_compare_owner and lm_owner_key

After the update to use nlm_lockowners for the NLM server, there are no
more users of lm_compare_owner and lm_owner_key.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Benjamin Coddington and committed by
J. Bruce Fields
f85d9338 646d73e9

-21
-14
Documentation/filesystems/Locking
··· 361 361 362 362 ----------------------- lock_manager_operations --------------------------- 363 363 prototypes: 364 - int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 365 - unsigned long (*lm_owner_key)(struct file_lock *); 366 364 void (*lm_notify)(struct file_lock *); /* unblock callback */ 367 365 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 368 366 void (*lm_break)(struct file_lock *); /* break_lease callback */ ··· 369 371 locking rules: 370 372 371 373 inode->i_lock blocked_lock_lock may block 372 - lm_compare_owner: yes[1] maybe no 373 - lm_owner_key yes[1] yes no 374 374 lm_notify: yes yes no 375 375 lm_grant: no no no 376 376 lm_break: yes no no 377 377 lm_change yes no no 378 - 379 - [1]: ->lm_compare_owner and ->lm_owner_key are generally called with 380 - *an* inode->i_lock held. It may not be the i_lock of the inode 381 - associated with either file_lock argument! This is the case with deadlock 382 - detection, since the code has to chase down the owners of locks that may 383 - be entirely unrelated to the one on which the lock is being acquired. 384 - For deadlock detection however, the blocked_lock_lock is also held. The 385 - fact that these locks are held ensures that the file_locks do not 386 - disappear out from under you while doing the comparison or generating an 387 - owner key. 388 378 389 379 --------------------------- buffer_head ----------------------------------- 390 380 prototypes:
-5
fs/locks.c
··· 658 658 */ 659 659 static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2) 660 660 { 661 - if (fl1->fl_lmops && fl1->fl_lmops->lm_compare_owner) 662 - return fl2->fl_lmops == fl1->fl_lmops && 663 - fl1->fl_lmops->lm_compare_owner(fl1, fl2); 664 661 return fl1->fl_owner == fl2->fl_owner; 665 662 } 666 663 ··· 698 701 static unsigned long 699 702 posix_owner_key(struct file_lock *fl) 700 703 { 701 - if (fl->fl_lmops && fl->fl_lmops->lm_owner_key) 702 - return fl->fl_lmops->lm_owner_key(fl); 703 704 return (unsigned long)fl->fl_owner; 704 705 } 705 706
-2
include/linux/fs.h
··· 1019 1019 }; 1020 1020 1021 1021 struct lock_manager_operations { 1022 - int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 1023 - unsigned long (*lm_owner_key)(struct file_lock *); 1024 1022 fl_owner_t (*lm_get_owner)(fl_owner_t); 1025 1023 void (*lm_put_owner)(fl_owner_t); 1026 1024 void (*lm_notify)(struct file_lock *); /* unblock callback */