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

NFS: remove l_pid field from nfs_lockowner

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>

authored by

NeilBrown and committed by
Trond Myklebust
b184b5c3 4d3b55d3

+2 -9
-3
fs/nfs/inode.c
··· 703 703 { 704 704 atomic_set(&l_ctx->count, 1); 705 705 l_ctx->lockowner.l_owner = current->files; 706 - l_ctx->lockowner.l_pid = current->tgid; 707 706 INIT_LIST_HEAD(&l_ctx->list); 708 707 atomic_set(&l_ctx->io_count, 0); 709 708 } ··· 714 715 715 716 do { 716 717 if (pos->lockowner.l_owner != current->files) 717 - continue; 718 - if (pos->lockowner.l_pid != current->tgid) 719 718 continue; 720 719 atomic_inc(&pos->count); 721 720 return pos;
-1
fs/nfs/nfs4proc.c
··· 2947 2947 } else if (truncate && state != NULL) { 2948 2948 struct nfs_lockowner lockowner = { 2949 2949 .l_owner = current->files, 2950 - .l_pid = current->tgid, 2951 2950 }; 2952 2951 if (!nfs4_valid_open_stateid(state)) 2953 2952 return -EBADF;
+1 -2
fs/nfs/pagelist.c
··· 867 867 static bool nfs_match_lock_context(const struct nfs_lock_context *l1, 868 868 const struct nfs_lock_context *l2) 869 869 { 870 - return l1->lockowner.l_owner == l2->lockowner.l_owner 871 - && l1->lockowner.l_pid == l2->lockowner.l_pid; 870 + return l1->lockowner.l_owner == l2->lockowner.l_owner; 872 871 } 873 872 874 873 /**
+1 -2
fs/nfs/write.c
··· 1151 1151 if (l_ctx && flctx && 1152 1152 !(list_empty_careful(&flctx->flc_posix) && 1153 1153 list_empty_careful(&flctx->flc_flock))) { 1154 - do_flush |= l_ctx->lockowner.l_owner != current->files 1155 - || l_ctx->lockowner.l_pid != current->tgid; 1154 + do_flush |= l_ctx->lockowner.l_owner != current->files; 1156 1155 } 1157 1156 nfs_release_request(req); 1158 1157 if (!do_flush)
-1
include/linux/nfs_fs.h
··· 57 57 58 58 struct nfs_lockowner { 59 59 fl_owner_t l_owner; 60 - pid_t l_pid; 61 60 }; 62 61 63 62 struct nfs_lock_context {