aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 12:19:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 12:19:15 -0400
commitbf97293eb878df3792d9de7213bd7b82135aea77 (patch)
tree16cb367bd78095b9eb8a54c800fcddfcccb618c7 /fs/nfs/file.c
parent16d70e15295953b19ecf59e943723a181782b856 (diff)
parentb1b3e136948a2bf4915326acb0d825d7d180753f (diff)
Merge tag 'nfs-for-3.12-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client updates from Trond Myklebust: "Highlights include: - Fix NFSv4 recovery so that it doesn't recover lost locks in cases such as lease loss due to a network partition, where doing so may result in data corruption. Add a kernel parameter to control choice of legacy behaviour or not. - Performance improvements when 2 processes are writing to the same file. - Flush data to disk when an RPCSEC_GSS session timeout is imminent. - Implement NFSv4.1 SP4_MACH_CRED state protection to prevent other NFS clients from being able to manipulate our lease and file locking state. - Allow sharing of RPCSEC_GSS caches between different rpc clients. - Fix the broken NFSv4 security auto-negotiation between client and server. - Fix rmdir() to wait for outstanding sillyrename unlinks to complete - Add a tracepoint framework for debugging NFSv4 state recovery issues. - Add tracing to the generic NFS layer. - Add tracing for the SUNRPC socket connection state. - Clean up the rpc_pipefs mount/umount event management. - Merge more patches from Chuck in preparation for NFSv4 migration support" * tag 'nfs-for-3.12-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (107 commits) NFSv4: use mach cred for SECINFO_NO_NAME w/ integrity NFS: nfs_compare_super shouldn't check the auth flavour unless 'sec=' was set NFSv4: Allow security autonegotiation for submounts NFSv4: Disallow security negotiation for lookups when 'sec=' is specified NFSv4: Fix security auto-negotiation NFS: Clean up nfs_parse_security_flavors() NFS: Clean up the auth flavour array mess NFSv4.1 Use MDS auth flavor for data server connection NFS: Don't check lock owner compatability unless file is locked (part 2) NFS: Don't check lock owner compatibility in writes unless file is locked nfs4: Map NFS4ERR_WRONG_CRED to EPERM nfs4.1: Add SP4_MACH_CRED write and commit support nfs4.1: Add SP4_MACH_CRED stateid support nfs4.1: Add SP4_MACH_CRED secinfo support nfs4.1: Add SP4_MACH_CRED cleanup support nfs4.1: Add state protection handler nfs4.1: Minimal SP4_MACH_CRED implementation SUNRPC: Replace pointer values with task->tk_pid and rpc_clnt->cl_clid SUNRPC: Add an identifier for struct rpc_clnt SUNRPC: Ensure rpc_task->tk_pid is available for tracepoints ...
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 94e94bd11aae..1e6bfdbc1aff 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -37,6 +37,8 @@
37#include "iostat.h" 37#include "iostat.h"
38#include "fscache.h" 38#include "fscache.h"
39 39
40#include "nfstrace.h"
41
40#define NFSDBG_FACILITY NFSDBG_FILE 42#define NFSDBG_FACILITY NFSDBG_FILE
41 43
42static const struct vm_operations_struct nfs_file_vm_ops; 44static const struct vm_operations_struct nfs_file_vm_ops;
@@ -294,6 +296,8 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
294 int ret; 296 int ret;
295 struct inode *inode = file_inode(file); 297 struct inode *inode = file_inode(file);
296 298
299 trace_nfs_fsync_enter(inode);
300
297 do { 301 do {
298 ret = filemap_write_and_wait_range(inode->i_mapping, start, end); 302 ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
299 if (ret != 0) 303 if (ret != 0)
@@ -310,6 +314,7 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
310 end = LLONG_MAX; 314 end = LLONG_MAX;
311 } while (ret == -EAGAIN); 315 } while (ret == -EAGAIN);
312 316
317 trace_nfs_fsync_exit(inode, ret);
313 return ret; 318 return ret;
314} 319}
315 320
@@ -406,6 +411,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
406 struct page *page, void *fsdata) 411 struct page *page, void *fsdata)
407{ 412{
408 unsigned offset = pos & (PAGE_CACHE_SIZE - 1); 413 unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
414 struct nfs_open_context *ctx = nfs_file_open_context(file);
409 int status; 415 int status;
410 416
411 dfprintk(PAGECACHE, "NFS: write_end(%s/%s(%ld), %u@%lld)\n", 417 dfprintk(PAGECACHE, "NFS: write_end(%s/%s(%ld), %u@%lld)\n",
@@ -441,6 +447,13 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
441 if (status < 0) 447 if (status < 0)
442 return status; 448 return status;
443 NFS_I(mapping->host)->write_io += copied; 449 NFS_I(mapping->host)->write_io += copied;
450
451 if (nfs_ctx_key_to_expire(ctx)) {
452 status = nfs_wb_all(mapping->host);
453 if (status < 0)
454 return status;
455 }
456
444 return copied; 457 return copied;
445} 458}
446 459
@@ -637,7 +650,8 @@ static int nfs_need_sync_write(struct file *filp, struct inode *inode)
637 if (IS_SYNC(inode) || (filp->f_flags & O_DSYNC)) 650 if (IS_SYNC(inode) || (filp->f_flags & O_DSYNC))
638 return 1; 651 return 1;
639 ctx = nfs_file_open_context(filp); 652 ctx = nfs_file_open_context(filp);
640 if (test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags)) 653 if (test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags) ||
654 nfs_ctx_key_to_expire(ctx))
641 return 1; 655 return 1;
642 return 0; 656 return 0;
643} 657}
@@ -651,6 +665,10 @@ ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
651 ssize_t result; 665 ssize_t result;
652 size_t count = iov_length(iov, nr_segs); 666 size_t count = iov_length(iov, nr_segs);
653 667
668 result = nfs_key_timeout_notify(iocb->ki_filp, inode);
669 if (result)
670 return result;
671
654 if (iocb->ki_filp->f_flags & O_DIRECT) 672 if (iocb->ki_filp->f_flags & O_DIRECT)
655 return nfs_file_direct_write(iocb, iov, nr_segs, pos, true); 673 return nfs_file_direct_write(iocb, iov, nr_segs, pos, true);
656 674