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

lockd: Show pid of lockd for remote locks

Use the pid of lockd instead of the remote lock's svid for the fl_pid for
local POSIX locks. This allows proper enumeration of which local process
owns which lock. The svid is meaningless to local lock readers.

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
646d73e9 9adfac6d

+4 -6
+1
fs/lockd/svc4proc.c
··· 46 46 47 47 /* Set up the missing parts of the file_lock structure */ 48 48 lock->fl.fl_file = file->f_file; 49 + lock->fl.fl_pid = current->tgid; 49 50 lock->fl.fl_lmops = &nlmsvc_lock_operations; 50 51 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); 51 52 if (!lock->fl.fl_owner) {
+2 -2
fs/lockd/svclock.c
··· 432 432 433 433 /* set default data area */ 434 434 call->a_args.lock.oh.data = call->a_owner; 435 - call->a_args.lock.svid = lock->fl.fl_pid; 435 + call->a_args.lock.svid = ((struct nlm_lockowner *)lock->fl.fl_owner)->pid; 436 436 437 437 if (lock->oh.len > NLMCLNT_OHSIZE) { 438 438 void *data = kmalloc(lock->oh.len, GFP_KERNEL); ··· 634 634 conflock->caller = "somehost"; /* FIXME */ 635 635 conflock->len = strlen(conflock->caller); 636 636 conflock->oh.len = 0; /* don't return OH info */ 637 - conflock->svid = lock->fl.fl_pid; 637 + conflock->svid = ((struct nlm_lockowner *)lock->fl.fl_owner)->pid; 638 638 conflock->fl.fl_type = lock->fl.fl_type; 639 639 conflock->fl.fl_start = lock->fl.fl_start; 640 640 conflock->fl.fl_end = lock->fl.fl_end;
+1
fs/lockd/svcproc.c
··· 76 76 77 77 /* Set up the missing parts of the file_lock structure */ 78 78 lock->fl.fl_file = file->f_file; 79 + lock->fl.fl_pid = current->tgid; 79 80 lock->fl.fl_lmops = &nlmsvc_lock_operations; 80 81 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); 81 82 if (!lock->fl.fl_owner) {
-2
fs/lockd/xdr.c
··· 126 126 lock->svid = ntohl(*p++); 127 127 128 128 locks_init_lock(fl); 129 - fl->fl_pid = (pid_t)lock->svid; 130 129 fl->fl_flags = FL_POSIX; 131 130 fl->fl_type = F_RDLCK; /* as good as anything else */ 132 131 start = ntohl(*p++); ··· 267 268 memset(lock, 0, sizeof(*lock)); 268 269 locks_init_lock(&lock->fl); 269 270 lock->svid = ~(u32) 0; 270 - lock->fl.fl_pid = (pid_t)lock->svid; 271 271 272 272 if (!(p = nlm_decode_cookie(p, &argp->cookie)) 273 273 || !(p = xdr_decode_string_inplace(p, &lock->caller,
-2
fs/lockd/xdr4.c
··· 118 118 lock->svid = ntohl(*p++); 119 119 120 120 locks_init_lock(fl); 121 - fl->fl_pid = (pid_t)lock->svid; 122 121 fl->fl_flags = FL_POSIX; 123 122 fl->fl_type = F_RDLCK; /* as good as anything else */ 124 123 p = xdr_decode_hyper(p, &start); ··· 264 265 memset(lock, 0, sizeof(*lock)); 265 266 locks_init_lock(&lock->fl); 266 267 lock->svid = ~(u32) 0; 267 - lock->fl.fl_pid = (pid_t)lock->svid; 268 268 269 269 if (!(p = nlm4_decode_cookie(p, &argp->cookie)) 270 270 || !(p = xdr_decode_string_inplace(p, &lock->caller,