aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.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/inode.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/inode.c')
-rw-r--r--fs/nfs/inode.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 941246f2b43d..87e797640828 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -38,7 +38,6 @@
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/compat.h> 39#include <linux/compat.h>
40#include <linux/freezer.h> 40#include <linux/freezer.h>
41#include <linux/crc32.h>
42 41
43#include <asm/uaccess.h> 42#include <asm/uaccess.h>
44 43
@@ -52,6 +51,8 @@
52#include "nfs.h" 51#include "nfs.h"
53#include "netns.h" 52#include "netns.h"
54 53
54#include "nfstrace.h"
55
55#define NFSDBG_FACILITY NFSDBG_VFS 56#define NFSDBG_FACILITY NFSDBG_VFS
56 57
57#define NFS_64_BIT_INODE_NUMBERS_ENABLED 1 58#define NFS_64_BIT_INODE_NUMBERS_ENABLED 1
@@ -503,6 +504,8 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
503 if ((attr->ia_valid & ~(ATTR_FILE|ATTR_OPEN)) == 0) 504 if ((attr->ia_valid & ~(ATTR_FILE|ATTR_OPEN)) == 0)
504 return 0; 505 return 0;
505 506
507 trace_nfs_setattr_enter(inode);
508
506 /* Write all dirty data */ 509 /* Write all dirty data */
507 if (S_ISREG(inode->i_mode)) { 510 if (S_ISREG(inode->i_mode)) {
508 nfs_inode_dio_wait(inode); 511 nfs_inode_dio_wait(inode);
@@ -522,6 +525,7 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
522 error = nfs_refresh_inode(inode, fattr); 525 error = nfs_refresh_inode(inode, fattr);
523 nfs_free_fattr(fattr); 526 nfs_free_fattr(fattr);
524out: 527out:
528 trace_nfs_setattr_exit(inode, error);
525 return error; 529 return error;
526} 530}
527EXPORT_SYMBOL_GPL(nfs_setattr); 531EXPORT_SYMBOL_GPL(nfs_setattr);
@@ -591,6 +595,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
591 int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; 595 int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME;
592 int err; 596 int err;
593 597
598 trace_nfs_getattr_enter(inode);
594 /* Flush out writes to the server in order to update c/mtime. */ 599 /* Flush out writes to the server in order to update c/mtime. */
595 if (S_ISREG(inode->i_mode)) { 600 if (S_ISREG(inode->i_mode)) {
596 nfs_inode_dio_wait(inode); 601 nfs_inode_dio_wait(inode);
@@ -621,6 +626,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
621 stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); 626 stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode));
622 } 627 }
623out: 628out:
629 trace_nfs_getattr_exit(inode, err);
624 return err; 630 return err;
625} 631}
626EXPORT_SYMBOL_GPL(nfs_getattr); 632EXPORT_SYMBOL_GPL(nfs_getattr);
@@ -875,6 +881,8 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
875 dfprintk(PAGECACHE, "NFS: revalidating (%s/%Ld)\n", 881 dfprintk(PAGECACHE, "NFS: revalidating (%s/%Ld)\n",
876 inode->i_sb->s_id, (long long)NFS_FILEID(inode)); 882 inode->i_sb->s_id, (long long)NFS_FILEID(inode));
877 883
884 trace_nfs_revalidate_inode_enter(inode);
885
878 if (is_bad_inode(inode)) 886 if (is_bad_inode(inode))
879 goto out; 887 goto out;
880 if (NFS_STALE(inode)) 888 if (NFS_STALE(inode))
@@ -925,6 +933,7 @@ err_out:
925 nfs4_label_free(label); 933 nfs4_label_free(label);
926out: 934out:
927 nfs_free_fattr(fattr); 935 nfs_free_fattr(fattr);
936 trace_nfs_revalidate_inode_exit(inode, status);
928 return status; 937 return status;
929} 938}
930 939
@@ -981,6 +990,7 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map
981 spin_unlock(&inode->i_lock); 990 spin_unlock(&inode->i_lock);
982 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); 991 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE);
983 nfs_fscache_wait_on_invalidate(inode); 992 nfs_fscache_wait_on_invalidate(inode);
993
984 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", 994 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n",
985 inode->i_sb->s_id, (long long)NFS_FILEID(inode)); 995 inode->i_sb->s_id, (long long)NFS_FILEID(inode));
986 return 0; 996 return 0;
@@ -1014,8 +1024,12 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
1014 if (ret < 0) 1024 if (ret < 0)
1015 goto out; 1025 goto out;
1016 } 1026 }
1017 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) 1027 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) {
1028 trace_nfs_invalidate_mapping_enter(inode);
1018 ret = nfs_invalidate_mapping(inode, mapping); 1029 ret = nfs_invalidate_mapping(inode, mapping);
1030 trace_nfs_invalidate_mapping_exit(inode, ret);
1031 }
1032
1019out: 1033out:
1020 return ret; 1034 return ret;
1021} 1035}
@@ -1195,7 +1209,7 @@ u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh)
1195{ 1209{
1196 /* wireshark uses 32-bit AUTODIN crc and does a bitwise 1210 /* wireshark uses 32-bit AUTODIN crc and does a bitwise
1197 * not on the result */ 1211 * not on the result */
1198 return ~crc32(0xFFFFFFFF, &fh->data[0], fh->size); 1212 return nfs_fhandle_hash(fh);
1199} 1213}
1200 1214
1201/* 1215/*
@@ -1274,9 +1288,17 @@ static int nfs_inode_attrs_need_update(const struct inode *inode, const struct n
1274 1288
1275static int nfs_refresh_inode_locked(struct inode *inode, struct nfs_fattr *fattr) 1289static int nfs_refresh_inode_locked(struct inode *inode, struct nfs_fattr *fattr)
1276{ 1290{
1291 int ret;
1292
1293 trace_nfs_refresh_inode_enter(inode);
1294
1277 if (nfs_inode_attrs_need_update(inode, fattr)) 1295 if (nfs_inode_attrs_need_update(inode, fattr))
1278 return nfs_update_inode(inode, fattr); 1296 ret = nfs_update_inode(inode, fattr);
1279 return nfs_check_inode_attributes(inode, fattr); 1297 else
1298 ret = nfs_check_inode_attributes(inode, fattr);
1299
1300 trace_nfs_refresh_inode_exit(inode, ret);
1301 return ret;
1280} 1302}
1281 1303
1282/** 1304/**