Skip to content

Commit 7b587e1

Browse files
NeilBrownjtlayton
authored andcommitted
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 <[email protected]> Reviewed-by: J. Bruce Fields <[email protected]> Signed-off-by: Jeff Layton <[email protected]>
1 parent ad6bbd8 commit 7b587e1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/nfs/nfs4proc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6311,7 +6311,8 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl,
63116311
/* Ensure we don't close file until we're done freeing locks! */
63126312
p->ctx = get_nfs_open_context(ctx);
63136313
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);
63156316
p->server = NFS_SERVER(inode);
63166317
return p;
63176318
}
@@ -6533,7 +6534,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
65336534
p->server = server;
65346535
refcount_inc(&lsp->ls_count);
65356536
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);
65376539
return p;
65386540
out_free_seqid:
65396541
nfs_free_seqid(p->arg.open_seqid);

0 commit comments

Comments
 (0)