Skip to content

Commit 1113cdf

Browse files
committed
Merge tag 'nfs-for-4.1-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull two NFS client bugfixes from Trond Myklebust: "Highlights include: - fix a Linux-4.1 regression affecting stat() - take an extra reference to fl->fl_file when running a setlk" * tag 'nfs-for-4.1-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: nfs: take extra reference to fl->fl_file when running a setlk nfs: stat(2) fails during cthon04 basic test5 on NFSv4.0
2 parents 416716e + feaff8e commit 1113cdf

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

fs/nfs/nfs4proc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <linux/mm.h>
3939
#include <linux/delay.h>
4040
#include <linux/errno.h>
41+
#include <linux/file.h>
4142
#include <linux/string.h>
4243
#include <linux/ratelimit.h>
4344
#include <linux/printk.h>
@@ -5604,6 +5605,7 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
56045605
p->server = server;
56055606
atomic_inc(&lsp->ls_count);
56065607
p->ctx = get_nfs_open_context(ctx);
5608+
get_file(fl->fl_file);
56075609
memcpy(&p->fl, fl, sizeof(p->fl));
56085610
return p;
56095611
out_free_seqid:
@@ -5716,6 +5718,7 @@ static void nfs4_lock_release(void *calldata)
57165718
nfs_free_seqid(data->arg.lock_seqid);
57175719
nfs4_put_lock_state(data->lsp);
57185720
put_nfs_open_context(data->ctx);
5721+
fput(data->fl.fl_file);
57195722
kfree(data);
57205723
dprintk("%s: done!\n", __func__);
57215724
}

fs/nfs/write.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,12 +1845,15 @@ int nfs_wb_all(struct inode *inode)
18451845
trace_nfs_writeback_inode_enter(inode);
18461846

18471847
ret = filemap_write_and_wait(inode->i_mapping);
1848-
if (!ret) {
1849-
ret = nfs_commit_inode(inode, FLUSH_SYNC);
1850-
if (!ret)
1851-
pnfs_sync_inode(inode, true);
1852-
}
1848+
if (ret)
1849+
goto out;
1850+
ret = nfs_commit_inode(inode, FLUSH_SYNC);
1851+
if (ret < 0)
1852+
goto out;
1853+
pnfs_sync_inode(inode, true);
1854+
ret = 0;
18531855

1856+
out:
18541857
trace_nfs_writeback_inode_exit(inode, ret);
18551858
return ret;
18561859
}

0 commit comments

Comments
 (0)