diff options
author | Benjamin Coddington <bcodding@redhat.com> | 2019-05-23 10:45:47 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2019-07-03 17:52:09 -0400 |
commit | 646d73e91b4222ea972953bad4374a5ca903e79d (patch) | |
tree | fcd45f943866ade75475b66a11b579bb3d1c8a58 | |
parent | 9adfac6d730db5e9c4c294798f5f191b621f8bc3 (diff) |
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>
-rw-r--r-- | fs/lockd/svc4proc.c | 1 | ||||
-rw-r--r-- | fs/lockd/svclock.c | 4 | ||||
-rw-r--r-- | fs/lockd/svcproc.c | 1 | ||||
-rw-r--r-- | fs/lockd/xdr.c | 2 | ||||
-rw-r--r-- | fs/lockd/xdr4.c | 2 |
5 files changed, 4 insertions, 6 deletions
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index a00134fd8956..e4d3f783e06a 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
@@ -46,6 +46,7 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
46 | 46 | ||
47 | /* Set up the missing parts of the file_lock structure */ | 47 | /* Set up the missing parts of the file_lock structure */ |
48 | lock->fl.fl_file = file->f_file; | 48 | lock->fl.fl_file = file->f_file; |
49 | lock->fl.fl_pid = current->tgid; | ||
49 | lock->fl.fl_lmops = &nlmsvc_lock_operations; | 50 | lock->fl.fl_lmops = &nlmsvc_lock_operations; |
50 | nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); | 51 | nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); |
51 | if (!lock->fl.fl_owner) { | 52 | if (!lock->fl.fl_owner) { |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 637c50687fd7..5f9f19b81754 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -432,7 +432,7 @@ static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock) | |||
432 | 432 | ||
433 | /* set default data area */ | 433 | /* set default data area */ |
434 | call->a_args.lock.oh.data = call->a_owner; | 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 | if (lock->oh.len > NLMCLNT_OHSIZE) { | 437 | if (lock->oh.len > NLMCLNT_OHSIZE) { |
438 | void *data = kmalloc(lock->oh.len, GFP_KERNEL); | 438 | void *data = kmalloc(lock->oh.len, GFP_KERNEL); |
@@ -634,7 +634,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
634 | conflock->caller = "somehost"; /* FIXME */ | 634 | conflock->caller = "somehost"; /* FIXME */ |
635 | conflock->len = strlen(conflock->caller); | 635 | conflock->len = strlen(conflock->caller); |
636 | conflock->oh.len = 0; /* don't return OH info */ | 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 | conflock->fl.fl_type = lock->fl.fl_type; | 638 | conflock->fl.fl_type = lock->fl.fl_type; |
639 | conflock->fl.fl_start = lock->fl.fl_start; | 639 | conflock->fl.fl_start = lock->fl.fl_start; |
640 | conflock->fl.fl_end = lock->fl.fl_end; | 640 | conflock->fl.fl_end = lock->fl.fl_end; |
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 36245ab43ae3..d0bb7a6bf005 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
@@ -76,6 +76,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
76 | 76 | ||
77 | /* Set up the missing parts of the file_lock structure */ | 77 | /* Set up the missing parts of the file_lock structure */ |
78 | lock->fl.fl_file = file->f_file; | 78 | lock->fl.fl_file = file->f_file; |
79 | lock->fl.fl_pid = current->tgid; | ||
79 | lock->fl.fl_lmops = &nlmsvc_lock_operations; | 80 | lock->fl.fl_lmops = &nlmsvc_lock_operations; |
80 | nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); | 81 | nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); |
81 | if (!lock->fl.fl_owner) { | 82 | if (!lock->fl.fl_owner) { |
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c index ec717ae41ee3..982629f7b120 100644 --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c | |||
@@ -126,7 +126,6 @@ nlm_decode_lock(__be32 *p, struct nlm_lock *lock) | |||
126 | lock->svid = ntohl(*p++); | 126 | lock->svid = ntohl(*p++); |
127 | 127 | ||
128 | locks_init_lock(fl); | 128 | locks_init_lock(fl); |
129 | fl->fl_pid = (pid_t)lock->svid; | ||
130 | fl->fl_flags = FL_POSIX; | 129 | fl->fl_flags = FL_POSIX; |
131 | fl->fl_type = F_RDLCK; /* as good as anything else */ | 130 | fl->fl_type = F_RDLCK; /* as good as anything else */ |
132 | start = ntohl(*p++); | 131 | start = ntohl(*p++); |
@@ -268,7 +267,6 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p) | |||
268 | memset(lock, 0, sizeof(*lock)); | 267 | memset(lock, 0, sizeof(*lock)); |
269 | locks_init_lock(&lock->fl); | 268 | locks_init_lock(&lock->fl); |
270 | lock->svid = ~(u32) 0; | 269 | lock->svid = ~(u32) 0; |
271 | lock->fl.fl_pid = (pid_t)lock->svid; | ||
272 | 270 | ||
273 | if (!(p = nlm_decode_cookie(p, &argp->cookie)) | 271 | if (!(p = nlm_decode_cookie(p, &argp->cookie)) |
274 | || !(p = xdr_decode_string_inplace(p, &lock->caller, | 272 | || !(p = xdr_decode_string_inplace(p, &lock->caller, |
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c index 45741adfe041..5fa9f48a9dba 100644 --- a/fs/lockd/xdr4.c +++ b/fs/lockd/xdr4.c | |||
@@ -118,7 +118,6 @@ nlm4_decode_lock(__be32 *p, struct nlm_lock *lock) | |||
118 | lock->svid = ntohl(*p++); | 118 | lock->svid = ntohl(*p++); |
119 | 119 | ||
120 | locks_init_lock(fl); | 120 | locks_init_lock(fl); |
121 | fl->fl_pid = (pid_t)lock->svid; | ||
122 | fl->fl_flags = FL_POSIX; | 121 | fl->fl_flags = FL_POSIX; |
123 | fl->fl_type = F_RDLCK; /* as good as anything else */ | 122 | fl->fl_type = F_RDLCK; /* as good as anything else */ |
124 | p = xdr_decode_hyper(p, &start); | 123 | p = xdr_decode_hyper(p, &start); |
@@ -265,7 +264,6 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p) | |||
265 | memset(lock, 0, sizeof(*lock)); | 264 | memset(lock, 0, sizeof(*lock)); |
266 | locks_init_lock(&lock->fl); | 265 | locks_init_lock(&lock->fl); |
267 | lock->svid = ~(u32) 0; | 266 | lock->svid = ~(u32) 0; |
268 | lock->fl.fl_pid = (pid_t)lock->svid; | ||
269 | 267 | ||
270 | if (!(p = nlm4_decode_cookie(p, &argp->cookie)) | 268 | if (!(p = nlm4_decode_cookie(p, &argp->cookie)) |
271 | || !(p = xdr_decode_string_inplace(p, &lock->caller, | 269 | || !(p = xdr_decode_string_inplace(p, &lock->caller, |