aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs
AgeCommit message (Collapse)AuthorFilesLines
2013-09-03NFS: Ensure that rmdir() waits for sillyrenames to completeTrond Myklebust2-6/+20
If an NFS client does mkdir("dir"); fd = open("dir/file"); unlink("dir/file"); close(fd); rmdir("dir"); then the asynchronous nature of the sillyrename operation means that we can end up getting EBUSY for the rmdir() in the above test. Fix that by ensuring that we wait for any in-progress sillyrenames before sending the rmdir() to the server. Signed-off-by: Trond Myklebust <[email protected]>
2013-09-03NFSv4: use the mach cred for SECINFO w/ integrityWeston Andros Adamson1-6/+47
Commit 5ec16a8500d339b0e7a0cc76b785d18daad354d4 introduced a regression that causes SECINFO to fail without actualy sending an RPC if: 1) the nfs_client's rpc_client was using KRB5i/p (now tried by default) 2) the current user doesn't have valid kerberos credentials This situation is quite common - as of now a sec=sys mount would use krb5i for the nfs_client's rpc_client and a user would hardly be faulted for not having run kinit. The solution is to use the machine cred when trying to use an integrity protected auth flavor for SECINFO. Older servers may not support using the machine cred or an integrity protected auth flavor for SECINFO in every circumstance, so we fall back to using the user's cred and the filesystem's auth flavor in this case. We run into another problem when running against linux nfs servers - they return NFS4ERR_WRONGSEC when using integrity auth flavor (unless the mount is also that flavor) even though that is not a valid error for SECINFO*. Even though it's against spec, handle WRONGSEC errors on SECINFO by falling back to using the user cred and the filesystem's auth flavor. Signed-off-by: Weston Andros Adamson <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-09-03NFS avoid expired credential keys for buffered writesAndy Adamson3-1/+43
We must avoid buffering a WRITE that is using a credential key (e.g. a GSS context key) that is about to expire or has expired. We currently will paint ourselves into a corner by returning success to the applciation for such a buffered WRITE, only to discover that we do not have permission when we attempt to flush the WRITE (and potentially associated COMMIT) to disk. Use the RPC layer credential key timeout and expire routines which use a a watermark, gss_key_expire_timeo. We test the key in nfs_file_write. If a WRITE is using a credential with a key that will expire within watermark seconds, flush the inode in nfs_write_end and send only NFS_FILE_SYNC WRITEs by adding nfs_ctx_key_to_expire to nfs_need_sync_write. Note that this results in single page NFS_FILE_SYNC WRITEs. Signed-off-by: Andy Adamson <[email protected]> [Trond: removed a pr_warn_ratelimited() for now] Signed-off-by: Trond Myklebust <[email protected]>
2013-09-01NFSv4: Convert idmapper to use the new framework for pipefs dentriesTrond Myklebust1-150/+34
Signed-off-by: Trond Myklebust <[email protected]>
2013-08-30NFSv4: Fix a potentially Oopsable condition in __nfs_idmap_unregisterTrond Myklebust1-1/+3
Ensure that __nfs_idmap_unregister can be called twice without consequences. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-30SUNRPC: Replace clnt->cl_principalTrond Myklebust1-1/+4
The clnt->cl_principal is being used exclusively to store the service target name for RPCSEC_GSS/krb5 callbacks. Replace it with something that is stored only in the RPCSEC_GSS-specific code. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-30NFS: Fix up two use-after-free issues with the new tracing codeTrond Myklebust1-2/+2
We don't want to pass the context argument to trace_nfs_atomic_open_exit() after it has been released. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: remove incorrect "Lock reclaim failed!" warning.NeilBrown1-7/+9
After reclaiming state that was lost, the NFS client tries to reclaim any locks, and then checks that each one has NFS_LOCK_INITIALIZED set (which means that the server has confirmed the lock). However if the client holds a delegation, nfs_reclaim_locks() simply aborts (or more accurately it called nfs_lock_reclaim() and that returns without doing anything). This is because when a delegation is held, the server doesn't need to know about locks. So if a delegation is held, NFS_LOCK_INITIALIZED is not expected, and its absence is certainly not an error. So don't print the warnings if NFS_DELGATED_STATE is set. Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4.1: Add tracepoints for debugging test_stateid eventsTrond Myklebust2-0/+52
Add tracepoints to detect issues with the TEST_STATEID operation. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4.1: Add tracepoints for debugging slot table operationsTrond Myklebust5-0/+154
Add tracepoints to nfs41_setup_sequence and nfs41_sequence_done to track session and slot table state changes. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4.1: Add tracepoints for debugging layoutget/return/commitTrond Myklebust2-0/+61
Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging reads and writesTrond Myklebust5-0/+169
Set up tracepoints to track read, write and commit, as well as pNFS reads and writes and commits to the data server. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging getattrTrond Myklebust2-2/+74
Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging the idmapperTrond Myklebust2-0/+51
Add tracepoints to help debug uid/gid mappings to username/group. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging delegationsTrond Myklebust4-0/+79
Set up tracepoints to track when delegations are set, reclaimed, returned by the client, or recalled by the server. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging renameTrond Myklebust2-4/+49
Add tracepoints to debug renames. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging inode manipulationsTrond Myklebust2-14/+73
Set up basic tracepoints for debugging NFSv4 setattr, access, readlink, readdir, get_acl set_acl get_security_label, and set_security_label. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging lookup/create operationsTrond Myklebust2-14/+72
Set up basic tracepoints for debugging NFSv4 lookup, unlink/remove, symlink, mkdir, mknod, fs_locations and secinfo. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging file lockingTrond Myklebust2-2/+82
Set up basic tracepoints for debugging NFSv4 file lock/unlock Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging file openTrond Myklebust2-0/+129
Set up basic tracepoints for debugging NFSv4 file open/close Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Add tracepoints for debugging state management problemsTrond Myklebust4-1/+245
Set up basic tracepoints for debugging client id creation/destruction and session creation/destruction. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: Add tracepoints for debugging NFS hard linksTrond Myklebust2-0/+72
Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: Add tracepoints for debugging NFS rename and sillyrename issuesTrond Myklebust3-0/+146
Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: Add tracepoints for debugging directory changesTrond Myklebust2-1/+104
Add tracepoints for mknod, mkdir, rmdir, remove (unlink) and symlink. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: Add tracepoints for debugging generic file create eventsTrond Myklebust2-0/+72
Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: Add event tracing for generic NFS lookupsTrond Myklebust3-0/+203
Add tracepoints for lookup, lookup_revalidate and atomic_open Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: Pass in lookup flags from nfs_atomic_open to nfs_lookupTrond Myklebust1-1/+3
When doing an open of a directory, ensure that we do pass the lookup flags from nfs_atomic_open into nfs_lookup. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: Add event tracing for generic NFS eventsTrond Myklebust7-11/+231
Add tracepoints for inode attribute updates, attribute revalidation, writeback start/end fsync start/end, attribute change start/end, permission check start/end. The intention is to enable performance tracing using 'perf'as well as improving debugging. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: refactor code for calculating the crc32 hash of a filehandleTrond Myklebust2-2/+21
We want to be able to display the crc32 hash of the filehandle in tracepoints. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFS: Clean up nfs_sillyrename()Trond Myklebust1-10/+16
Optimise for the case where we only do one lookup. Clean up the code so it is obvious that silly[] is not a dynamic array. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-22NFSv4: Fix an incorrect pointer declaration in decode_first_pnfs_layout_typeTrond Myklebust1-1/+1
We always encode to __be32 format in XDR: silences a sparse warning. Signed-off-by: Trond Myklebust <[email protected]> Cc: Andy Adamson <[email protected]>
2013-08-22NFSv4: Deal with a sparse warning in nfs_idmap_get_key()Trond Myklebust1-1/+1
Signed-off-by: Trond Myklebust <[email protected]> Cc: Bryan Schumaker <[email protected]>
2013-08-22NFSv4: Deal with some more sparse warningsTrond Myklebust2-7/+7
Technically, we don't really need to convert these time stamps, since they are actually cookies. Signed-off-by: Trond Myklebust <[email protected]> Cc: Chuck Lever <[email protected]>
2013-08-22NFSv4: Deal with a sparse warning in nfs4_opendata_allocTrond Myklebust1-1/+1
Signed-off-by: Trond Myklebust <[email protected]>
2013-08-21NFSv3: Deal with a sparse warning in nfs3_proc_createTrond Myklebust1-2/+2
Signed-off-by: Trond Myklebust <[email protected]>
2013-08-20NFS: Remove the NFSv4 "open optimisation" from nfs_permissionTrond Myklebust1-5/+0
Ever since commit 6168f62cb (Add ACCESS operation to OPEN compound) the NFSv4 atomic open has primed the access cache, and so nfs_permission will no longer do an RPC call on the wire. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-08NFSv4.1 Use clientid management rpc_clnt for secinfo_no_nameAndy Adamson1-1/+6
As per RFC 5661 Security Considerations Commit 4edaa308 "NFS: Use "krb5i" to establish NFSv4 state whenever possible" uses the nfs_client cl_rpcclient for all clientid management operations. Signed-off-by: Andy Adamson <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-08NFSv4.1 Use clientid management rpc_clnt for secinfoAndy Adamson1-1/+6
As per RFC 3530 and RFC 5661 Security Considerations Commit 4edaa308 "NFS: Use "krb5i" to establish NFSv4 state whenever possible" uses the nfs_client cl_rpcclient for all clientid management operations. Signed-off-by: Andy Adamson <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07NFSv4: Fix up nfs4_proc_lookup_mountpointTrond Myklebust1-5/+3
Currently, we do not check the return value of client = rpc_clone_client(), nor do we shut down the resulting cloned rpc_clnt in the case where a NFS4ERR_WRONGSEC has caused nfs4_proc_lookup_common() to replace the original value of 'client' (causing a memory leak). Fix both issues and simplify the code by moving the call to rpc_clone_client() until after nfs4_proc_lookup_common() has done its business. Reported-by: Andy Adamson <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07NFS: Remove unnecessary call to nfs_setsecurity in nfs_fhget()Trond Myklebust1-1/+0
We only need to call it on the creation of the inode. Reported-by: Julia Lawall <[email protected]> Cc: Steve Dickson <[email protected]> Cc: Dave Quigley <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07NFSv4: Fix the sync mount option for nfs4 mountsScott Mayhew1-0/+4
The sync mount option stopped working for NFSv4 mounts after commit c02d7adf8c5429727a98bad1d039bccad4c61c50 (NFSv4: Replace nfs4_path_walk() with FS path lookup in a private namespace). If MS_SYNCHRONOUS is set in the super_block that we're cloning from, then it should be set in the new super_block as well. Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07NFS: Fix writeback performance issue on cache invalidationTrond Myklebust1-2/+8
If a cache invalidation is triggered, and we happen to have a lot of writebacks cached at the time, then the call to invalidate_inode_pages2() will end up calling ->launder_page() on each and every dirty page in order to sync its contents to disk, thus defeating write coalescing. The following patch ensures that we try to sync the inode to disk before calling invalidate_inode_pages2() so that we do the writeback as efficiently as possible. Reported-by: William Dauchy <[email protected]> Reported-by: Pascal Bouchareine <[email protected]> Signed-off-by: Trond Myklebust <[email protected]> Tested-by: William Dauchy <[email protected]> Reviewed-by: Jeff Layton <[email protected]>
2013-08-07NFSv4.1 Increase NFS4_DEF_SLOT_TABLE_SIZEAndy Adamson1-1/+1
Increase NFS4_DEF_SLOT_TABLE_SIZE which is used as the client ca_maxreequests value in CREATE_SESSION. Current non-dynamic session slot server implementations use the client ca_maxrequests as a maximum slot number: 64 session slots can handle most workloads. Signed-off-by: Andy Adamson <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07NFS Remove unused authflavour parameter from init_clientAndy Adamson3-9/+5
Signed-off-by: Andy Adamson <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07NFS: Never use user credentials for lease renewalChuck Lever4-58/+11
Never try to use a non-UID 0 user credential for lease management, as that credential can change out from under us. The server will block NFSv4 lease recovery with NFS4ERR_CLID_INUSE. Since the mechanism to acquire a credential for lease management is now the same for all minor versions, replace the minor version- specific callout with a single function. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07NFS: Use root's credential for lease management when keytab is missingChuck Lever1-1/+18
Commit 05f4c350 "NFS: Discover NFSv4 server trunking when mounting" Fri Sep 14 17:24:32 2012 introduced Uniform Client String support, which forces our NFS client to establish a client ID immediately during a mount operation rather than waiting until a user wants to open a file. Normally machine credentials (eg. from a keytab) are used to perform a mount operation that is protected by Kerberos. Before 05fc350, SETCLIENTID used a machine credential, or fell back to a regular user's credential if no keytab is available. On clients that don't have a keytab, performing SETCLIENTID early means there's no user credential to fall back on, since no regular user has kinit'd yet. 05f4c350 seems to have broken the ability to mount with sec=krb5 on clients that don't have a keytab in kernels 3.7 - 3.10. To address this regression, commit 4edaa308 (NFS: Use "krb5i" to establish NFSv4 state whenever possible), Sat Mar 16 15:56:20 2013, was merged in 3.10. This commit forces the NFS client to fall back to AUTH_SYS for lease management operations if no keytab is available. Neil Brown noticed that, since root is required to kinit to do a sec=krb5 mount when a client doesn't have a keytab, we can try to use root's Kerberos credential before AUTH_SYS. Now, when determining a principal and flavor to use for lease management, the NFS client tries in this order: 1. Flavor: AUTH_GSS, krb5i Principal: service principal (via keytab) 2. Flavor: AUTH_GSS, krb5i Principal: user principal established for UID 0 (via kinit) 3. Flavor: AUTH_SYS Principal: UID 0 / GID 0 Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07NFSv4: Refuse mount attempts with proto=udpTrond Myklebust1-0/+12
RFC3530 disallows the use of udp as a transport protocol for NFSv4. Signed-off-by: Trond Myklebust <[email protected]>
2013-08-07nfs: verify open flags before allowing an atomic openJeff Layton1-0/+4
Currently, you can open a NFSv4 file with O_APPEND|O_DIRECT, but cannot fcntl(F_SETFL,...) with those flags. This flag combination is explicitly forbidden on NFSv3 opens, and it seems like it should also be on NFSv4. Reported-by: Chao Ye <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2013-07-30aio: Kill aio_rw_vect_retry()Kent Overstreet1-1/+0
This code doesn't serve any purpose anymore, since the aio retry infrastructure has been removed. This change should be safe because aio_read/write are also used for synchronous IO, and called from do_sync_read()/do_sync_write() - and there's no looping done in the sync case (the read and write syscalls). Signed-off-by: Kent Overstreet <[email protected]> Cc: Zach Brown <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Asai Thambi S P <[email protected]> Cc: Selvan Mani <[email protected]> Cc: Sam Bradshaw <[email protected]> Cc: Jeff Moyer <[email protected]> Cc: Al Viro <[email protected]> Cc: Benjamin LaHaise <[email protected]> Signed-off-by: Benjamin LaHaise <[email protected]>
2013-07-24NFSv4: Fix nfs4_init_uniform_client_string for net namespacesTrond Myklebust1-2/+6
Commit 6f2ea7f2a (NFS: Add nfs4_unique_id boot parameter) introduces a boot parameter that allows client administrators to set a string identifier for use by the EXCHANGE_ID and SETCLIENTID arguments in order to make them more globally unique. Unfortunately, that uniquifier is no longer globally unique in the presence of net namespaces, since each container expects to be able to set up their own lease when mounting a new NFSv4/4.1 partition. The fix is to add back in the container-specific hostname in addition to the unique id. Cc: Chuck Lever <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>