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

Configure Feed

Select the types of activity you want to include in your feed.

lockd: lockd server-side shouldn't set fl_ops

Locks have two sets of op arrays, fl_lmops for the lock manager (lockd
or nfsd), fl_ops for the filesystem. The server-side lockd code has
been setting its own fl_ops, which leads to confusion (and crashes) in
the reexport case, where the filesystem expects to be the only one
setting fl_ops.

And there's no reason for it that I can see-the lm_get/put_owner ops do
the same job.

Reported-by: Daire Byrne <daire@dneg.com>
Tested-by: Daire Byrne <daire@dneg.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

J. Bruce Fields and committed by
Chuck Lever
7de875b2 400edd8c

+12 -18
+12 -18
fs/lockd/svclock.c
··· 395 395 nlmsvc_put_lockowner(lock->fl.fl_owner); 396 396 } 397 397 398 - static void nlmsvc_locks_copy_lock(struct file_lock *new, struct file_lock *fl) 399 - { 400 - struct nlm_lockowner *nlm_lo = (struct nlm_lockowner *)fl->fl_owner; 401 - new->fl_owner = nlmsvc_get_lockowner(nlm_lo); 402 - } 403 - 404 - static void nlmsvc_locks_release_private(struct file_lock *fl) 405 - { 406 - nlmsvc_put_lockowner((struct nlm_lockowner *)fl->fl_owner); 407 - } 408 - 409 - static const struct file_lock_operations nlmsvc_lock_ops = { 410 - .fl_copy_lock = nlmsvc_locks_copy_lock, 411 - .fl_release_private = nlmsvc_locks_release_private, 412 - }; 413 - 414 398 void nlmsvc_locks_init_private(struct file_lock *fl, struct nlm_host *host, 415 399 pid_t pid) 416 400 { 417 401 fl->fl_owner = nlmsvc_find_lockowner(host, pid); 418 - if (fl->fl_owner != NULL) 419 - fl->fl_ops = &nlmsvc_lock_ops; 420 402 } 421 403 422 404 /* ··· 770 788 printk(KERN_WARNING "lockd: notification for unknown block!\n"); 771 789 } 772 790 791 + static fl_owner_t nlmsvc_get_owner(fl_owner_t owner) 792 + { 793 + return nlmsvc_get_lockowner(owner); 794 + } 795 + 796 + static void nlmsvc_put_owner(fl_owner_t owner) 797 + { 798 + nlmsvc_put_lockowner(owner); 799 + } 800 + 773 801 const struct lock_manager_operations nlmsvc_lock_operations = { 774 802 .lm_notify = nlmsvc_notify_blocked, 775 803 .lm_grant = nlmsvc_grant_deferred, 804 + .lm_get_owner = nlmsvc_get_owner, 805 + .lm_put_owner = nlmsvc_put_owner, 776 806 }; 777 807 778 808 /*