aboutsummaryrefslogtreecommitdiff
path: root/fs
AgeCommit message (Collapse)Author
2009-06-17lockd: Don't bother with RPC ping for NSM upcallsChuck Lever
Cut NSM upcall RPC traffic in half -- don't do a NULL call first. The cases where a ping would be helpful are rare. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17lockd: Update NSM state from SM_MON repliesChuck Lever
When rpc.statd starts up in user space at boot time, it attempts to write the latest NSM local state number into /proc/sys/fs/nfs/nsm_local_state. If lockd.ko isn't loaded yet (as is the case in most configurations), that file doesn't exist, thus the kernel's NSM state remains set to its initial value of zero during lockd operation. This is a problem because rpc.statd and lockd use the NSM state number to prevent repeated lock recovery on rebooted hosts. If lockd sends a zero NSM state, but then a delayed SM_NOTIFY with a real NSM state number is received, there is no way for lockd or rpc.statd to distinguish that stale SM_NOTIFY from an actual reboot. Thus lock recovery could be performed after the rebooted host has already started reclaiming locks, and those locks will be lost. We could change /etc/init.d/nfslock so it always modprobes lockd.ko before starting rpc.statd. However, if lockd.ko is ever unloaded and reloaded, we are back at square one, since the NSM state is not preserved across an unload/reload cycle. This may happen frequently on clients that use automounter. A period of NFS inactivity causes lockd.ko to be unloaded, and the kernel loses its NSM state setting. Instead, let's use the fact that rpc.statd plants the local system's NSM state in every SM_MON (and SM_UNMON) reply. lockd performs a synchronous SM_MON upcall to the local rpc.statd _before_ sending its first NLM request to a new remote. This would permit rpc.statd to provide the current NSM state to lockd, even after lockd.ko had been unloaded and reloaded. Note that NLMPROC_LOCK arguments are constructed before the nsm_monitor() call, so we have to rearrange argument construction very slightly to make this all work out. And, the kernel appears to treat NSM state as a u32 (see struct nlm_args and nsm_res). Make nsm_local_state a u32 as well, to ensure we don't get bogus comparison results. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17NFS: Fix false error return from nfs_callback_up() if ipv6.ko is not availableChuck Lever
Clear "ret" if the error return from svc_create_xprt(AF_INET6) was -EAFNOSUPORT. Otherwise, callback start-up will succeed, but nfs_callback_up() will return -EAFNOSUPPORT anyway, and the first NFSv4 mount attempt after a reboot will fail. Bug introduced by commit f738f517 in 2.6.30-rc1. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17NFS: Return error code from nfs_callback_up() to user spaceChuck Lever
If the kernel cannot start the NFSv4 callback service during a mount request, it returns -ENOMEM to user space, resulting in this message: mount.nfs4: Cannot allocate memory Adjust nfs_alloc_client() and nfs_get_client() to pass NFSv4 callback start-up errors back to user space so a less mysterious error message can be displayed by the mount command. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17NFS: Do not display the setting of the "intr" mount optionChuck Lever
The "intr" mount option has been deprecated for a while, but /proc/mounts continues to display "nointr" whether "intr" or "nointr" has been specified for a mount point. Since these options do not have any effect, simply do not display them. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17NFS: add support for splice writesSuresh Jayaraman
Adds support for splice writes. It effectively calls generic_file_splice_write() to do the writes. We need not worry about O_APPEND case as the combination of splice() writes and O_APPEND is disallowed. This patch propagates NFS write errors back to the caller. The number of bytes written via splice are being added to NFSIO_NORMALWRITTENBYTES as these are effectively cached writes. Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17Merge commit 'linux-pnfs/nfs41-for-2.6.31' into nfsv41-for-2.6.31Trond Myklebust
2009-06-17jbd2: clean up jbd2_journal_try_to_free_buffers()Hisashi Hifumi
This patch reverts 3f31fddf, which is no longer needed because if a race between freeing buffer and committing transaction functionality occurs and dio gets error, currently dio falls back to buffered IO due to the commit 6ccfa806. Signed-off-by: Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp> Cc: Mingming Cao <cmm@us.ibm.com> Acked-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-17nfs41: Backchannel: CB_SEQUENCE validationRicardo Labiaga
Validates the callback's sessionID, the slot number, and the sequence ID. Increments the slot's sequence. Detects replays, but simply prints a debug message (if debugging is enabled since we don't yet implement a duplicate request cache for the backchannel. This should not present a problem, since only idempotent callbacks are currently implemented. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: Backchannel: Be more obvious about the return value] [nfs41: Backchannel: dprink in host order] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Backchannel: New find_client_with_session()Ricardo Labiaga
Finds the 'struct nfs_client' that matches the server's address, major version number, and session ID. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Backchannel: Add a backchannel slot table to the sessionRicardo Labiaga
Defines a new 'struct nfs4_slot_table' in the 'struct nfs4_session' for use by the backchannel. Initializes, resets, and destroys the backchannel slot table in the same manner the forechannel slot table is initialized, reset, and destroyed. The sequenceid for each slot in the backchannel slot table is initialized to 0, whereas the forechannel slotid's sequenceid is set to 1. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Backchannel: Refactor nfs4_init_slot_table()Ricardo Labiaga
Generalize nfs4_init_slot_table() so it can be used to initialize the backchannel slot table in addition to the forechannel slot table. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Backchannel: Refactor nfs4_reset_slot_table()Ricardo Labiaga
Generalize nfs4_reset_slot_table() so it can be used to reset the backchannel slot table in addition to the forechannel slot table. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Backchannel: update cb_sequence args and resultsRicardo Labiaga
Change the type of cs_addr and csr_status to 'struct sockaddr' and '__be32' since the cb_sequence processing function will use existing functionality that expects these types. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: verify CB_SEQUENCE position in callback compoundBenny Halevy
CB_SEQUENCE must appear first in the callback compound RPC. If it is not the first operation NFS4ERR_SEQUENCE_POS must be returned. If the first operation ni the CB_COMPOUND is not CB_SEQUENCE then NFS4ERR_OP_NOT_IN_SESSION must be returned. Signed-off-by: Ricardo Labiaga <ricardo.labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: refactor op preprocessing out of process_op] Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: cb_sequence xdr implementationBenny Halevy
[nfs41: get rid of READMEM and COPYMEM for callback_xdr.c] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: get rid of READ64 in callback_xdr.c] See http://linux-nfs.org/pipermail/pnfs/2009-June/007846.html Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: cb_sequence proc implementationBenny Halevy
Currently, just free up any referring calls information. Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: fix csr_{,target}highestslotid] Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: cb_sequence protocol level data structuresBenny Halevy
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: consider minorversion in callback_xdr:process_opBenny Halevy
Note that this patch changes the nfsv4.0 behavior also when CONFIG_NFS_V4_1 is not defined where NFS4ERR_MINOR_VERS_MISMATCH will be returned if the client received a CB_COMPOUND with minorversion != 0. Previously, it would have returned NFS4ERR_OP_ILLEGAL for CB_SEQUENCE. (or if the server is broken and sent OP_CB_GETATTR or OP_CB_RECALL with minorversion!=0, they would have been processed normally. Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: refactor op preprocessing out of process_op] See http://linux-nfs.org/pipermail/pnfs/2009-June/007845.html [nfs41: define CB_NOTIFY_DEVICEID as not supported] Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: callback numbers definitionsBenny Halevy
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: decode minorversion 1 cb_compound headerBenny Halevy
decode cb_compound header conforming to http://tools.ietf.org/html/draft-ietf-nfsv4-minorversion1-26 Get rid of cb_compound_hdr_arg.callback_ident callback_ident is not used anywhere so we shouldn't waste any memory to store it. Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: no need to break read_buf in decode_compound_hdr_arg] See http://linux-nfs.org/pipermail/pnfs/2009-June/007844.html Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: store minorversion in cb_compound_hdr_argBenny Halevy
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Release backchannel resources associated with sessionAndy Adamson
Frees the preallocated backchannel resources that are associated with this session when the session is destroyed. A backchannel is currently created once per session. Destroy the backchannel only when the session is destroyed. Signed-off-by: Ricardo Labiaga <ricardo.labiaga@netapp.com> Signed-off-by: Andy Adamson<andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Client indicates presence of NFSv4.1 callback channel.Andy Adamson
Set the SESSION4_BACK_CHAN flag to indicate the client supports a backchannel. Signed-off-by: Ricardo Labiaga <ricardo.labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Setup the backchannelAndy Adamson
The NFS v4.1 callback service has already been setup, and rpc_xprt->serv points to the svc_serv structure describing it. Invoke the xprt_setup_backchannel() initialization to pre- allocate the necessary backchannel structures. Signed-off-by: Ricardo Labiaga <ricardo.labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: change nfs4_put_session(nfs4_session**) to nfs4_destroy_session(nfs_session*)] Signed-off-by: Alexandros Batsakis <Alexandros.Batsakis@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [moved xprt_setup_backchannel from nfs4_init_session to nfs4_init_backchannel] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Allow NFSv4 and NFSv4.1 callback services to coexistAndy Adamson
Tracks the nfs_callback_info for both versions, enabling the callback service for v4 and v4.1 to run concurrently and be stopped independently of each other. Signed-off-by: Ricardo Labiaga <ricardo.labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: create a svc_xprt for nfs41 callback thread and use for incoming ↵Benny Halevy
callbacks Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Implement NFSv4.1 callback service process.Ricardo Labiaga
nfs41_callback_up() initializes the necessary queues and creates the new nfs41_callback_svc thread. This thread executes the callback service which waits for requests to arrive on the svc_serv->sv_cb_list. NFS41_BC_MIN_CALLBACKS is set to 1 because we expect callbacks to not cause substantial latency. The actual processing of the callback will be implemented as a separate patch. There is only one NFSv4.1 callback service. The first caller of nfs4_callback_up() creates the service, subsequent callers increment a reference count on the service. The service is destroyed when the last caller invokes nfs_callback_down(). The transport needs to hold a reference to the callback service in order to invoke it during callback processing. Currently this reference is only obtained when the service is first created. This is incorrect, since subsequent registrations for other transports will leave the xprt->serv pointer uninitialized, leading to an oops when a callback arrives on the "unreferenced" transport. This patch fixes the problem by ensuring that a reference to the service is saved in xprt->serv, either because the service is created by this invocation to nfs4_callback_up() or by a prior invocation. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: Add a reference to svc_serv during callback service bring up] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Type check arguments of nfs_callback_up] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: save svc_serv in nfs_callback_info] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Removal of ugly #ifdefs] [nfs41: Update to removal of ugly #ifdefs] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17NFSv4/NLM: Push file locking BKL dependencies down into the NLM layerTrond Myklebust
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17NFS: Ensure we always hold the BKL when dereferencing inode->i_flockTrond Myklebust
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17NFSv4: Handle more errors when recovering open file and locking stateTrond Myklebust
It is possible for servers to return NFS4ERR_BAD_STATEID when the state management code is recovering locks or is reclaiming state when returning a delegation. Ensure that we handle that case. While we're at it, add in handlers for NFS4ERR_STALE, NFS4ERR_ADMIN_REVOKED, NFS4ERR_OPENMODE, NFS4ERR_DENIED and NFS4ERR_STALE_STATEID, since the protocol appears to allow for them too. Also handle ENOMEM... Finally, rather than add new NFSv4.0-specific errors and error handling into the generic delegation code, move that open file and locking state error handling into the NFSv4 layer. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17NFSv4: Move error handling out of the delegation generic codeTrond Myklebust
The NFSv4 delegation recovery code is required by the protocol to handle more errors. Rather than add NFSv4.0 specific errors into 'generic' delegation code, we should move the error handling into the NFSv4 layer. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17NFSv4: Fix the 'nolock' option regressionTrond Myklebust
NFSv4 should just ignore the 'nolock' option. It is an NFSv2/v3 thing... This fixes the Oops in http://bugzilla.kernel.org/show_bug.cgi?id=13330 Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: minorversion support for nfs4_{init,destroy}_callbackBenny Halevy
move nfs4_init_callback into nfs4_init_client_minor_version and nfs4_destroy_callback into nfs4_clear_client_minor_version as these need to happen also when auto-negotiating the minorversion once the callback service for nfs41 becomes different than for nfs4.0 Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: Fix checkpatch warning] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Type check arguments of nfs_callback_up] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: Backchannel: Remove FIXME comment] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: Refactor nfs4_{init,destroy}_callback for nfs4.0Benny Halevy
Refactor-out code to bring the callback service up and down. Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: increment_{open,lock}_seqidBenny Halevy
Unlike minorversion0, in nfsv4.1 the open and lock seqids need not be incremented by the client and should always be set to zero. This is implemented using a new nfs_rpc_ops methods - increment_open_seqid and increment_lock_seqid Signed-off-by: Rahul Iyer <iyer@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: check for session not minorversion] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: only retry EXCHANGE_ID on recoverable errorsAndy Adamson
Stops an infinite loop of EXCHANGE_ID. Signed-off-by: Andy Adamson <andros@netapp.com> [fixed checkpatch warnings] Signed-off-by: Benny Halevy <bhalevy@panasas.com>
2009-06-17nfs41: recover lease in _nfs4_lookup_rootBenny Halevy
This creates the nfsv4.1 session on mount. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: get_clid_cred for EXCHANGE_IDAndy Adamson
Unlike SETCLIENTID, EXCHANGE_ID requires a machine credential. Do not search for credentials other than the machine credential. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: add a get_clid_cred function to nfs4_state_recovery_opsAndy Adamson
EXCHANGE_ID has different credential requirements than SETCLIENTID. Prepare for a separate credential function. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: establish sessions-based clientidAndy Adamson
nfsv4.1 clientid is established via EXCHANGE_ID rather than SETCLIENTID{,_CONFIRM} This is implemented using a new establish_clid method in nfs4_state_recovery_ops. nfs41: establish clientid via exchange id only if cred != NULL >From 2.6.26 reclaimer() uses machine cred for setting up the client id therefore it is never expected to be NULL. Signed-off-by: Rahul Iyer <iyer@netapp.com> [removed dprintk] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: lease renewal] [revamped patch for new nfs4_state_manager design] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: introduce get_state_renewal_credAndy Adamson
Use the machine cred for sending SEQUENCE to renew the client's lease. [revamp patch for new state management design starting 2.6.29] [nfs41: support minorversion 1 for nfs4_check_lease] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: get cred in exchange_id when cred arg is NULL] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: use cl_machined_cred instead of cl_ex_cred] Since EXCHANGE_ID insists on using the machine credential, cl_ex_cred is not needed. nfs4_proc_exchange_id() is only called if the machine credential is available. Remove the credential logic from nfs4_proc_exchange_id. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: support minorversion 1 for nfs4_check_leaseBenny Halevy
[moved nfs4_get_renew_cred related changes to "nfs41: introduce get_state_renewal_cred"] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: lease renewalBenny Halevy
Send a NFSv4.1 SEQUENCE op rather than RENEW that was deprecated in minorversion 1. Use the nfs_client minorversion to select reboot_recover/ network_partition_recovery/state_renewal ops. Note: we use reclaimer to create the nfs41 session before there are any cl_superblocks for the nfs_client. Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: check for session not minorversion] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [revamped patch for new nfs4_state_manager design] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: obliterate nfs4_state_recovery_ops.renew_lease method] moved to nfs4_state_maintenance_ops [also undid per-minorversion nfs4_state_recovery_ops here] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: schedule async session resetAndy Adamson
Define a new session reset state which is set upon a sequence operation error in both the sync and async error handlers. Place all new requests and all but the last outstanding rpc on the slot_tbl_waitq. Spawn the recovery thread when the last slot is free. Call nfs4_proc_destroy_session, reinitialize the session, call nfs4_proc_create_session, clear the session reset state, and wake up the next task on the slot_tbl_waitq. Return the nfs4_proc_destroy_session status to the session reclaimer and check for NFS4ERR_BADSESSION and NFS4ERR_DEADSESSION. Other destroy session errors should be handled in nfs4_proc_destroy_session where the call can be retried with adjusted arguments. Signed-off-by: Andy Adamson<andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> nfs41: make nfs4_wait_bit_killable public] nfs4_wait_bit_killable to be used by NFSv4.1 session recover logic. Signed-off-by: Rahul Iyer <iyer@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: have create_session work on nfs_client] Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: trigger the state manager for session reset] Replace the session reset state with the NFS4CLNT_SESSION_SETUP cl_state. Place all rpc tasks to sleep on the slot table waitqueue until the slot table is drained, then schedule state recovery and wait for it to complete. Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: remove nfs41_session_recovery [ch] Replaced by using the nfs4_state_manager. Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: nfs4_wait_bit_killable only used locally] [nfs41: keep nfs4_wait_bit_killable static] [nfs41: keep const nfs_server in nfs4_handle_exception] [nfs41: remove session parameter from nfs4_find_slot] Signed-off-by: Andy Adamson <andros@netapp.com Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: resset the session from nfs41_setup_sequence] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: kick start nfs41 session recovery when handling errorsAndy Adamson
Remove checking for any errors that the SEQUENCE operation does not return. -NFS4ERR_STALE_CLIENTID, NFS4ERR_EXPIRED, NFS4ERR_CB_PATH_DOWN, NFS4ERR_BACK_CHAN_BUSY, NFS4ERR_OP_NOT_IN_SESSION. SEQUENCE operation error recovery is very primative, we only reset the session. Remove checking for any errors that are returned by the SEQUENCE operation, but that resetting the session won't address. NFS4ERR_RETRY_UNCACHED_REP, NFS4ERR_SEQUENCE_POS,NFS4ERR_TOO_MANY_OPS. Add error checking for missing SEQUENCE errors that a session reset will address. NFS4ERR_BAD_HIGH_SLOT, NFS4ERR_DEADSESSION, NFS4ERR_SEQ_FALSE_RETRY. A reset of the session is currently our only response to a SEQUENCE operation error. Don't reset the session on errors where a new session won't help. Don't reset the session on errors where a new session won't help. [nfs41: nfs4_async_handle_error update error checking] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: trigger the state manager for session reset] Replace session state bit with nfs_client state bit. Set the NFS4CLNT_SESSION_SETUP bit upon a session related error in the sync/async error handlers. [nfs41: _nfs4_async_handle_error fix session reset error list] Sequence operation errors that session reset could help. NFS4ERR_BADSESSION NFS4ERR_BADSLOT NFS4ERR_BAD_HIGH_SLOT NFS4ERR_DEADSESSION NFS4ERR_CONN_NOT_BOUND_TO_SESSION NFS4ERR_SEQ_FALSE_RETRY NFS4ERR_SEQ_MISORDERED Sequence operation errors that a session reset would not help NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_REP_TOO_BIG NFS4ERR_REP_TOO_BIG_TO_CACHE NFS4ERR_REQ_TOO_BIG NFS4ERR_RETRY_UNCACHED_REP NFS4ERR_SEQUENCE_POS NFS4ERR_TOO_MANY_OPS Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41 nfs4_handle_exception fix session reset error list] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [moved nfs41_sequece_call_done code to nfs41: sequence operation] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: use rpc prepare call state for session resetAndy Adamson
[nfs41: change nfs4_restart_rpc argument] [nfs41: check for session not minorversion] [nfs41: trigger the state manager for session reset] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [always define nfs4_restart_rpc] Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: add session reset to state managerAndy Adamson
Move the code to reset a session from the session_reclaimer to the nfs4_state_manager. Destroy the session, and create a new one. Treat NFS4ERR_BADSESSION and NFS4ERR_DEADSESSION as a successful nfs4_proc_destroy_session. Signal nfs4_proc_create_session that this is a session reset so that the session slot table is re-used. If the clientid is stale, set both NFS4CLNT_LEASE_EXPIRED and NFS4CLNT_SESSION_SETUP bits and retry. Use a switch statement in nfs4_session_recovery_handle_error for future patche which will add handling for other errors. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: session reset in nfs4_recovery_handle_error] Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: reset session on nfs4_do_reclaim session reset error] If nfs4_do_reclaim gets a session reset error, nfs4_recovery_handle_error will set the NFS4CLNT_SESSION_SETUP bit, and the state manager should continue processing to reset the session. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [move nfs4_proc_destroy_session declaration here] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: add session setup to the state managerAndy Adamson
At mount, nfs_alloc_client sets the cl_state NFS4CLNT_LEASE_EXPIRED bit and nfs4_alloc_session sets the NFS4CLNT_SESSION_SETUP bit, so both bits are set when nfs4_lookup_root calls nfs4_recover_expired_lease which schedules the nfs4_state_manager and waits for it to complete. Place the session setup after the clientid establishment in nfs4_state_manager so that the session is setup right after the clientid has been established without rescheduling the state manager. Unlike nfsv4.0, the nfs_client struct is not ready to use until the session has been established. Postpone marking the nfs_client struct to NFS_CS_READY until after a successful CREATE_SESSION call so that other threads cannot use the client until the session is established. If the EXCHANGE_ID call fails and the session has not been setup (the NFS4CLNT_SESSION_SETUP bit is set), mark the client with the error and return. If the session setup CREATE_SESSION call fails with NFS4ERR_STALE_CLIENTID which could occur due to server reboot or network partition inbetween the EXCHANGE_ID and CREATE_SESSION call, reset the NFS4CLNT_LEASE_EXPIRED and NFS4CLNT_SESSION_SETUP bits and try again. If the CREATE_SESSION call fails with other errors, mark the client with the error and return. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: NFS_CS_SESSION_SETUP cl_cons_state for back channel setup] On session setup, the CREATE_SESSION reply races with the server back channel probe which needs to succeed to setup the back channel. Set a new cl_cons_state NFS_CS_SESSION_SETUP just prior to the CREATE_SESSION call and add it as a valid state to nfs_find_client so that the client back channel can find the nfs_client struct and won't drop the server backchannel probe. Use a new cl_cons_state so that NFSv4.0 back channel behaviour which only sets NFS_CS_READY is unchanged. Adjust waiting on the nfs_client_active_wq accordingly. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: rename NFS_CS_SESSION_SETUP to NFS_CS_SESSION_INITING] Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: set NFS_CL_SESSION_INITING in alloc_session] Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: move session setup into a function] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [moved nfs4_proc_create_session declaration here] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-06-17nfs41: reset the session slot tableAndy Adamson
Separated from nfs41: schedule async session reset Do not kfree the session slot table upon session reset, just re-initialize it. Add a boolean to nfs4_proc_create_session to inidicate if this is a session reset or a session initialization. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>