diff options
author | Benjamin Coddington <bcodding@redhat.com> | 2017-01-05 10:20:16 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-01-12 12:51:29 -0500 |
commit | 4b09ec4b14a168bf2c687e1f598140c3c11e9222 (patch) | |
tree | f52a87c8690567266fa29b829ec231303f7cbe0d | |
parent | a121103c922847ba5010819a3f250f1f7fc84ab8 (diff) |
nfs: Don't take a reference on fl->fl_file for LOCK operation
I have reports of a crash that look like __fput() was called twice for
a NFSv4.0 file. It seems possible that the state manager could try to
reclaim a lock and take a reference on the fl->fl_file at the same time the
file is being released if, during the close(), a signal interrupts the wait
for outstanding IO while removing locks which then skips the removal
of that lock.
Since 83bfff23e9ed ("nfs4: have do_vfs_lock take an inode pointer") has
removed the need to traverse fl->fl_file->f_inode in nfs4_lock_done(),
taking that reference is no longer necessary.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6dcbc5defb7a..700ed1fc1075 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
41 | #include <linux/file.h> | ||
42 | #include <linux/string.h> | 41 | #include <linux/string.h> |
43 | #include <linux/ratelimit.h> | 42 | #include <linux/ratelimit.h> |
44 | #include <linux/printk.h> | 43 | #include <linux/printk.h> |
@@ -6127,7 +6126,6 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, | |||
6127 | p->server = server; | 6126 | p->server = server; |
6128 | atomic_inc(&lsp->ls_count); | 6127 | atomic_inc(&lsp->ls_count); |
6129 | p->ctx = get_nfs_open_context(ctx); | 6128 | p->ctx = get_nfs_open_context(ctx); |
6130 | get_file(fl->fl_file); | ||
6131 | memcpy(&p->fl, fl, sizeof(p->fl)); | 6129 | memcpy(&p->fl, fl, sizeof(p->fl)); |
6132 | return p; | 6130 | return p; |
6133 | out_free_seqid: | 6131 | out_free_seqid: |
@@ -6240,7 +6238,6 @@ static void nfs4_lock_release(void *calldata) | |||
6240 | nfs_free_seqid(data->arg.lock_seqid); | 6238 | nfs_free_seqid(data->arg.lock_seqid); |
6241 | nfs4_put_lock_state(data->lsp); | 6239 | nfs4_put_lock_state(data->lsp); |
6242 | put_nfs_open_context(data->ctx); | 6240 | put_nfs_open_context(data->ctx); |
6243 | fput(data->fl.fl_file); | ||
6244 | kfree(data); | 6241 | kfree(data); |
6245 | dprintk("%s: done!\n", __func__); | 6242 | dprintk("%s: done!\n", __func__); |
6246 | } | 6243 | } |