NFS: remove l_pid field from nfs_lockowner
authorNeilBrown <neilb@suse.com>
Thu, 13 Oct 2016 04:26:47 +0000 (15:26 +1100)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 1 Dec 2016 22:57:07 +0000 (17:57 -0500)
this field is not used in any important way and probably should
have been removed by

Commit: 8003d3c4aaa5 ("nfs4: treat lock owners as opaque values")

which removed the pid argument from nfs4_get_lock_state.

Except in unusual and uninteresting cases, two threads with the same
->tgid will have the same ->files pointer, so keeping them both
for comparison brings no benefit.

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/inode.c
fs/nfs/nfs4proc.c
fs/nfs/pagelist.c
fs/nfs/write.c
include/linux/nfs_fs.h

index 3575e3408bd7dc58cbb97a34b31a0ea25fcab907..fd991324971327bfca131d6faca15a6695161726 100644 (file)
@@ -703,7 +703,6 @@ static void nfs_init_lock_context(struct nfs_lock_context *l_ctx)
 {
        atomic_set(&l_ctx->count, 1);
        l_ctx->lockowner.l_owner = current->files;
-       l_ctx->lockowner.l_pid = current->tgid;
        INIT_LIST_HEAD(&l_ctx->list);
        atomic_set(&l_ctx->io_count, 0);
 }
@@ -716,8 +715,6 @@ static struct nfs_lock_context *__nfs_find_lock_context(struct nfs_open_context
        do {
                if (pos->lockowner.l_owner != current->files)
                        continue;
-               if (pos->lockowner.l_pid != current->tgid)
-                       continue;
                atomic_inc(&pos->count);
                return pos;
        } while ((pos = list_entry(pos->list.next, typeof(*pos), list)) != head);
index 5593b088c561957fab5c5397ea680949e7e8d8b4..0d108f13ef16c4314efe7548f8a9c35cd3fcad21 100644 (file)
@@ -2947,7 +2947,6 @@ static int _nfs4_do_setattr(struct inode *inode,
        } else if (truncate && state != NULL) {
                struct nfs_lockowner lockowner = {
                        .l_owner = current->files,
-                       .l_pid = current->tgid,
                };
                if (!nfs4_valid_open_stateid(state))
                        return -EBADF;
index 965db474f4b0d11d7a59fe839703c7505d714ce9..161f8b13bbaa1ebd442c03d9a57e31acebbdaa5e 100644 (file)
@@ -867,8 +867,7 @@ static void nfs_pageio_cleanup_mirroring(struct nfs_pageio_descriptor *pgio)
 static bool nfs_match_lock_context(const struct nfs_lock_context *l1,
                const struct nfs_lock_context *l2)
 {
-       return l1->lockowner.l_owner == l2->lockowner.l_owner
-               && l1->lockowner.l_pid == l2->lockowner.l_pid;
+       return l1->lockowner.l_owner == l2->lockowner.l_owner;
 }
 
 /**
index 53211838f72aac44c416b13ac926f3533d7e2553..4d5897e6d6cb52866d52b2916ddaf236b4658f1f 100644 (file)
@@ -1151,8 +1151,7 @@ int nfs_flush_incompatible(struct file *file, struct page *page)
                if (l_ctx && flctx &&
                    !(list_empty_careful(&flctx->flc_posix) &&
                      list_empty_careful(&flctx->flc_flock))) {
-                       do_flush |= l_ctx->lockowner.l_owner != current->files
-                               || l_ctx->lockowner.l_pid != current->tgid;
+                       do_flush |= l_ctx->lockowner.l_owner != current->files;
                }
                nfs_release_request(req);
                if (!do_flush)
index 810124b33327c5db6b13b180c0a8d0f19b79295c..bf8a713c45b46e9079b620eb970feef86c255e08 100644 (file)
@@ -57,7 +57,6 @@ struct nfs_access_entry {
 
 struct nfs_lockowner {
        fl_owner_t l_owner;
-       pid_t l_pid;
 };
 
 struct nfs_lock_context {