]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
lockd: Show pid of lockd for remote locks
authorBenjamin Coddington <bcodding@redhat.com>
Thu, 23 May 2019 14:45:47 +0000 (10:45 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 3 Jul 2019 21:52:09 +0000 (17:52 -0400)
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>
fs/lockd/svc4proc.c
fs/lockd/svclock.c
fs/lockd/svcproc.c
fs/lockd/xdr.c
fs/lockd/xdr4.c

index a00134fd8956812ff506fd6f20907e68564960f0..e4d3f783e06af6d3d76aa84d17697795353f8c10 100644 (file)
@@ -46,6 +46,7 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
 
                /* Set up the missing parts of the file_lock structure */
                lock->fl.fl_file  = file->f_file;
+               lock->fl.fl_pid = current->tgid;
                lock->fl.fl_lmops = &nlmsvc_lock_operations;
                nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
                if (!lock->fl.fl_owner) {
index 637c50687fd7f9db3cf40858ebc8939bbce22b83..5f9f19b817547e1301bc79d68023ab8c6353f6bf 100644 (file)
@@ -432,7 +432,7 @@ static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock)
 
        /* set default data area */
        call->a_args.lock.oh.data = call->a_owner;
-       call->a_args.lock.svid = lock->fl.fl_pid;
+       call->a_args.lock.svid = ((struct nlm_lockowner *)lock->fl.fl_owner)->pid;
 
        if (lock->oh.len > NLMCLNT_OHSIZE) {
                void *data = kmalloc(lock->oh.len, GFP_KERNEL);
@@ -634,7 +634,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
        conflock->caller = "somehost";  /* FIXME */
        conflock->len = strlen(conflock->caller);
        conflock->oh.len = 0;           /* don't return OH info */
-       conflock->svid = lock->fl.fl_pid;
+       conflock->svid = ((struct nlm_lockowner *)lock->fl.fl_owner)->pid;
        conflock->fl.fl_type = lock->fl.fl_type;
        conflock->fl.fl_start = lock->fl.fl_start;
        conflock->fl.fl_end = lock->fl.fl_end;
index 36245ab43ae3dd03482be9413826e820d7d99781..d0bb7a6bf00525154c9c974a882468f95854954b 100644 (file)
@@ -76,6 +76,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
 
                /* Set up the missing parts of the file_lock structure */
                lock->fl.fl_file  = file->f_file;
+               lock->fl.fl_pid = current->tgid;
                lock->fl.fl_lmops = &nlmsvc_lock_operations;
                nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
                if (!lock->fl.fl_owner) {
index ec717ae41ee3bd77b305cc992b41bf685d80e4e1..982629f7b120a423a69a68309b45a6707724b2cb 100644 (file)
@@ -126,7 +126,6 @@ nlm_decode_lock(__be32 *p, struct nlm_lock *lock)
        lock->svid  = ntohl(*p++);
 
        locks_init_lock(fl);
-       fl->fl_pid   = (pid_t)lock->svid;
        fl->fl_flags = FL_POSIX;
        fl->fl_type  = F_RDLCK;         /* as good as anything else */
        start = ntohl(*p++);
@@ -268,7 +267,6 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
        memset(lock, 0, sizeof(*lock));
        locks_init_lock(&lock->fl);
        lock->svid = ~(u32) 0;
-       lock->fl.fl_pid = (pid_t)lock->svid;
 
        if (!(p = nlm_decode_cookie(p, &argp->cookie))
         || !(p = xdr_decode_string_inplace(p, &lock->caller,
index 45741adfe0410d76e58b67c4a11161cbc323d824..5fa9f48a9dba74104fc3f3315bbcb37ab0dab2b7 100644 (file)
@@ -118,7 +118,6 @@ nlm4_decode_lock(__be32 *p, struct nlm_lock *lock)
        lock->svid  = ntohl(*p++);
 
        locks_init_lock(fl);
-       fl->fl_pid   = (pid_t)lock->svid;
        fl->fl_flags = FL_POSIX;
        fl->fl_type  = F_RDLCK;         /* as good as anything else */
        p = xdr_decode_hyper(p, &start);
@@ -265,7 +264,6 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
        memset(lock, 0, sizeof(*lock));
        locks_init_lock(&lock->fl);
        lock->svid = ~(u32) 0;
-       lock->fl.fl_pid = (pid_t)lock->svid;
 
        if (!(p = nlm4_decode_cookie(p, &argp->cookie))
         || !(p = xdr_decode_string_inplace(p, &lock->caller,