linux/fs/nfs
Andy Adamson 76db6d9500 nfs41: add session setup to the state manager
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-17 12:25:06 -07:00
..
callback_proc.c
callback_xdr.c
callback.c NFS: Start PF_INET6 callback listener only if IPv6 support is available 2009-03-28 16:02:43 -04:00
callback.h NFS: Start PF_INET6 callback listener only if IPv6 support is available 2009-03-28 16:02:43 -04:00
client.c nfs41: add session setup to the state manager 2009-06-17 12:25:06 -07:00
delegation.c NFSv4: Convert delegation->type field to fmode_t 2008-12-23 15:21:53 -05:00
delegation.h NFSv4: Convert delegation->type field to fmode_t 2008-12-23 15:21:53 -05:00
dir.c nfs: Fix NFS v4 client handling of MAY_EXEC in nfs_permission. 2009-05-18 20:11:12 -07:00
direct.c nfs41 commit sequence setup done support 2009-06-17 10:46:50 -07:00
file.c NFS: Close page_mkwrite() races 2009-05-02 19:42:39 -07:00
fscache-index.c NFS: Add read context retention for FS-Cache to call back with 2009-04-03 16:42:44 +01:00
fscache.c NFS: Store pages from an NFS inode into a local cache 2009-04-03 16:42:45 +01:00
fscache.h NFS: Display local caching state 2009-04-03 16:42:47 +01:00
getroot.c NFS: Fix the type of struct nfs_fattr->mode 2009-03-11 14:10:26 -04:00
idmap.c
inode.c NFS: Use local disk inode cache 2009-04-03 16:42:43 +01:00
internal.h nfs41: add session setup to the state manager 2009-06-17 12:25:06 -07:00
iostat.h NFS: Add some new I/O counters for FS-Cache doing things for NFS 2009-04-03 16:42:43 +01:00
Kconfig nfs41: Add Kconfig symbols for NFSv4.1 2009-06-17 10:46:13 -07:00
Makefile NFS: Define and create server-level objects 2009-04-03 16:42:42 +01:00
mount_clnt.c NFS: "[no]resvport" mount option changes mountd client too 2008-12-23 15:21:37 -05:00
namespace.c
nfs2xdr.c NFS: Fix the type of struct nfs_fattr->mode 2009-03-11 14:10:26 -04:00
nfs3acl.c NFSv3: Fix posix ACL code 2009-03-10 20:33:18 -04:00
nfs3proc.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2009-04-02 21:09:10 -07:00
nfs3xdr.c NFS: Fix the XDR iovec calculation in nfs3_xdr_setaclargs 2009-04-21 07:46:49 -07:00
nfs4_fs.h nfs41: add session setup to the state manager 2009-06-17 12:25:06 -07:00
nfs4namespace.c NFS: Fix misparsing of nfsv4 fs_locations attribute (take 2) 2009-03-10 20:33:17 -04:00
nfs4proc.c nfs41: add session setup to the state manager 2009-06-17 12:25:06 -07:00
nfs4renewd.c NFSv4: Return unreferenced delegations more promptly 2008-12-23 15:21:52 -05:00
nfs4state.c nfs41: add session setup to the state manager 2009-06-17 12:25:06 -07:00
nfs4xdr.c nfs41: sequence operation 2009-06-17 12:25:04 -07:00
nfsroot.c nfs: fix build error in nfsroot with initconst 2009-05-26 14:51:00 -04:00
pagelist.c NFS: Throttle page dirtying while we're flushing to disk 2009-03-11 14:10:30 -04:00
proc.c NFS: Optimise NFS close() 2009-03-19 15:35:50 -04:00
read.c nfs41: read sequence setup/done support 2009-06-17 10:46:48 -07:00
super.c nfs41: destroy_session operation 2009-06-17 12:24:55 -07:00
symlink.c
sysctl.c
unlink.c nfs41: unlink sequence setup/done support 2009-06-17 10:46:47 -07:00
write.c nfs41 commit sequence setup done support 2009-06-17 10:46:50 -07:00