diff options
author | NeilBrown <neilb@suse.com> | 2018-11-29 18:04:08 -0500 |
---|---|---|
committer | Jeff Layton <jlayton@kernel.org> | 2018-11-30 11:26:12 -0500 |
commit | 7b587e1a5a6cf6035ab1fbd6a1d00ce604eaf488 (patch) | |
tree | 617a4b092a7bb308366c5be64ae1774138a9740e /fs | |
parent | ad6bbd8b18dad182a7e91d7826e27e9a64d935f9 (diff) |
NFS: use locks_copy_lock() to copy locks.
Using memcpy() to copy lock requests leaves the various
list_head in an inconsistent state.
As we will soon attach a list of conflicting request to
another pending request, we need these lists to be consistent.
So change NFS to use locks_init_lock/locks_copy_lock instead
of memcpy.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 867457d6dfbe..0ba2b0fb8ff3 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -6311,7 +6311,8 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, | |||
6311 | /* Ensure we don't close file until we're done freeing locks! */ | 6311 | /* Ensure we don't close file until we're done freeing locks! */ |
6312 | p->ctx = get_nfs_open_context(ctx); | 6312 | p->ctx = get_nfs_open_context(ctx); |
6313 | p->l_ctx = nfs_get_lock_context(ctx); | 6313 | p->l_ctx = nfs_get_lock_context(ctx); |
6314 | memcpy(&p->fl, fl, sizeof(p->fl)); | 6314 | locks_init_lock(&p->fl); |
6315 | locks_copy_lock(&p->fl, fl); | ||
6315 | p->server = NFS_SERVER(inode); | 6316 | p->server = NFS_SERVER(inode); |
6316 | return p; | 6317 | return p; |
6317 | } | 6318 | } |
@@ -6533,7 +6534,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, | |||
6533 | p->server = server; | 6534 | p->server = server; |
6534 | refcount_inc(&lsp->ls_count); | 6535 | refcount_inc(&lsp->ls_count); |
6535 | p->ctx = get_nfs_open_context(ctx); | 6536 | p->ctx = get_nfs_open_context(ctx); |
6536 | memcpy(&p->fl, fl, sizeof(p->fl)); | 6537 | locks_init_lock(&p->fl); |
6538 | locks_copy_lock(&p->fl, fl); | ||
6537 | return p; | 6539 | return p; |
6538 | out_free_seqid: | 6540 | out_free_seqid: |
6539 | nfs_free_seqid(p->arg.open_seqid); | 6541 | nfs_free_seqid(p->arg.open_seqid); |