16 Dec, 2009
4 commits
-
Commit 5601a00d671fe89f9b087513244abcd08ad67e7d (nfs: run state manager
in privileged mode) introduces a regression in the NFSv4 code when
compiled with CONFIG_NFS_V4_1. The calls to nfs4_end_drain_session()
from the main loop in nfs4_state_manager() Oops due to the lack of an
NFSv4.1 session when running NFSv4.0.The fix is to move those two calls back into nfs41_init_clientid() and
nfs4_reset_session().The calls to nfs4_end_drain_session() that remain inside
nfs4_state_manager() are safe, since the NFSv4.0 code will never set the
NFS4CLNT_SESSION_DRAINING bit.Signed-off-by: Trond Myklebust
-
If the CLOSE or OPEN_DOWNGRADE call triggers a state recovery, and has
to be resent, then we must release the seqid. Otherwise the open
recovery will wait for the close to finish, which causes a deadlock.This is mainly a NFSv4.1 problem, although it can theoretically happen
with NFSv4.0 too, in a OPEN_DOWNGRADE situation.Signed-off-by: Trond Myklebust
-
Signed-off-by: Alexandros Batsakis
Signed-off-by: Trond Myklebust -
Signed-off-by: Alexandros Batsakis
Signed-off-by: Trond Myklebust
09 Dec, 2009
1 commit
-
The NFSv4.1 spec indicates RECLAIM_COMPLETE is to be issued
whenever a client establishes a new client id, not only after
detecting the server has rebooted.Set the NFS4CLNT_RECLAIM_REBOOT bit after every new client id has
been established. This enables us to issue RECLAIM_COMPLETE
during the wrap up of the NFS4CLNT_RECLAIM_REBOOT state.Signed-off-by: Ricardo Labiaga
Signed-off-by: Trond Myklebust
07 Dec, 2009
3 commits
-
The state manager was not marking the stateids as needing to be reclaimed
after reestablishing the clientid.Signed-off-by: Ricardo Labiaga
Signed-off-by: Trond Myklebust -
If CREATE_SESSION fails with NFS4ERR_STALE_CLIENTID, don't clear the
NFS4CLNT_SESSION_DRAINING flag and don't wake RPCs waiting for the
session to be reestablished. We don't have a session yet, so there
is no reason to wake other RPCs.This avoids sending spurious compounds with bogus sequenceID during
session and state recovery.Signed-off-by: Ricardo Labiaga
[Trond.Myklebust@netapp.com: cleaned up patch by adding the
nfs41_begin/end_drain_session() helpers]
Signed-off-by: Trond Myklebust -
Move call to get the lease time and the setup of the state
renewal out of nfs4_create_session so that it can be called
after clearing the DRAINING flag. We use the getattr RPC
to obtain the lease time, which requires a sequence slot.Signed-off-by: Ricardo Labiaga
Signed-off-by: Trond Myklebust
06 Dec, 2009
6 commits
-
Signed-off-by: Trond Myklebust
-
We should not assume that nfs41_init_clientid() will always want to
initialise the session. If it is being called due to a server reboot, then
we just want to reset the session after re-establishing the clientid.Fix this by getting rid of the 'reset' parameter in
nfs4_proc_create_session(), and instead relying on whether or not the
session slot table pointer is non-NULL.Signed-off-by: Trond Myklebust
-
This patch invokes RECLAIM_COMPLETE after the client is done
reclaiming state.There are interpretations of the spec that suggest that
RECLAIM_COMPLETE should also be issued after a new clientid
has been obtained from the server and even if there is no
state to reclaim. This tells the server that the client
has no state to reclaim even if the client isn't aware the
server may have rebooted.Signed-off-by: Ricardo Labiaga
Signed-off-by: Trond Myklebust -
Implements RECLAIM_COMPLETE as an asynchronous RPC.
NFS4ERR_DELAY is retried, NFS4ERR_DEADSESSION invokes the error handling
but does not result in a retry, since we don't want to have a lingering
RECLAIM_COMPLETE call sent in the middle of a possible new state recovery
cycle. If a session reset occurs, a new wave of reclaim operations will
follow, containing their own RECLAIM_COMPLETE call. We don't want a
retry to get on the way of recovery by incorrectly indicating to the
server that we're done reclaiming state.A subsequent patch invokes the functionality.
Signed-off-by: Ricardo Labiaga
Signed-off-by: Trond Myklebust -
Otherwise we have no guarantees that other processes won't start another
RPC call while we're resetting the session.Signed-off-by: Trond Myklebust
-
the server can indicate a number of error conditions by setting the
appropriate bits in the SEQUENCE operation. The client re-establishes
state with the server when it receives one of those, with the action
depending on the specific case.Signed-off-by: Alexandros Batsakis
Signed-off-by: Trond Myklebust
05 Dec, 2009
5 commits
-
Replace sync and async handlers setting of the NFS4CLNT_SESSION_SETUP bit with
setting NFS4CLNT_CHECK_LEASE, and let the state manager decide to reset the session.Signed-off-by: Andy Adamson
Signed-off-by: Trond Myklebust -
If the session is reset during state recovery, the state manager thread can
sleep on the slot_tbl_waitq causing a deadlock.Add a completion framework to the session. Have the state manager thread set
a new session state (NFS4CLNT_SESSION_DRAINING) and wait for the session slot
table to drain.Signal the state manager thread in nfs41_sequence_free_slot when the
NFS4CLNT_SESSION_DRAINING bit is set and the session is drained.Reported-by: Trond Myklebust
Signed-off-by: Andy Adamson
Signed-off-by: Trond Myklebust -
Do not fall through and set NFS4CLNT_SESSION_RESET bit on NFS4ERR_EXPIRED
Signed-off-by: Andy Adamson
Signed-off-by: Trond Myklebust -
The bit is no longer used for session setup, only for session reset.
Signed-off-by: Andy Adamson
Signed-off-by: Trond Myklebust -
Reported-by: Trond Myklebust
Resetting the clientid from the state manager could result in not confirming
the clientid due to create session not being called.Move the create session call from the NFS4CLNT_SESSION_SETUP state manager
initialize session case into the NFS4CLNT_LEASE_EXPIRED case establish_clid
call.Signed-off-by: Andy Adamson
Signed-off-by: Trond Myklebust
04 Dec, 2009
6 commits
-
Signed-off-by: Trond Myklebust
-
The nfs4_state_manager should not be looking at the error values when
deciding whether or not to loop round in order to handle a higher priority
state recovery task. It should rather be looking at the clp->cl_state.Signed-off-by: Trond Myklebust
-
Signed-off-by: Trond Myklebust
-
nfs4_recovery_handle_error() will correctly handle errors such as
NFS4ERR_CB_PATH_DOWN, however because they are still passed back to the
main loop in nfs4_state_manager(), they can cause the latter to exit
prematurely.Fix this by letting nfs4_recovery_handle_error() change the error value in
cases where there is no action required by the caller.Signed-off-by: Trond Myklebust
-
In practice, we need to ensure that we call nfs4_state_end_reclaim_reboot
in 2 cases:- If we lose the lease while we were reclaiming state
OR
- After we're done with reboot recoverySigned-off-by: Trond Myklebust
22 Sep, 2009
1 commit
-
Signed-off-by: Alexey Dobriyan
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
25 Aug, 2009
1 commit
-
Commit 76db6d9500caeaa774a3e32a997eba30bbdc176b (nfs41: add session setup
to the state manager) introduces an infinite loop possibility in the NFSv4
state manager. By first checking nfs4_has_session() before clearing the
NFS4CLNT_SESSION_SETUP flag, it allows for a situation where someone sets
that flag, but it never gets cleared, and so the state manager loops.In fact commit c3fad1b1aaf850bf692642642ace7cd0d64af0a3 (nfs41: add session
reset to state manager) causes this to happen every time we get a network
partition error.Signed-off-by: Trond Myklebust
Tested-by: Daniel J Blueman
Signed-off-by: Linus Torvalds
22 Jul, 2009
1 commit
-
The oops http://www.kerneloops.org/raw.php?rawid=537858&msgid= appears to
be due to the nfs4_lock_state->ls_state field being uninitialised. This
happens if the call to nfs4_free_lock_state() is triggered at the end of
nfs4_get_lock_state().The fix is to move the initialisation of ls_state into the allocator.
Signed-off-by: Trond Myklebust
19 Jun, 2009
1 commit
-
Conflicts:
fs/nfs/client.c
fs/nfs/super.c
18 Jun, 2009
11 commits
-
Signed-off-by: Trond 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
-
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_seqidSigned-off-by: Rahul Iyer
Signed-off-by: Benny Halevy
[nfs41: check for session not minorversion]
Signed-off-by: Andy Adamson
Signed-off-by: Benny Halevy
Signed-off-by: Trond Myklebust -
Stops an infinite loop of EXCHANGE_ID.
Signed-off-by: Andy Adamson
[fixed checkpatch warnings]
Signed-off-by: Benny Halevy -
Unlike SETCLIENTID, EXCHANGE_ID requires a machine credential. Do not search
for credentials other than the machine credential.Signed-off-by: Andy Adamson
Signed-off-by: Benny Halevy
Signed-off-by: Trond Myklebust -
EXCHANGE_ID has different credential requirements than SETCLIENTID.
Prepare for a separate credential function.Signed-off-by: Andy Adamson
Signed-off-by: Benny Halevy
Signed-off-by: Trond Myklebust -
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
[removed dprintk]
Signed-off-by: Benny Halevy
[nfs41: lease renewal]
[revamped patch for new nfs4_state_manager design]
Signed-off-by: Benny Halevy
Signed-off-by: Trond Myklebust -
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
[nfs41: get cred in exchange_id when cred arg is NULL]
Signed-off-by: Benny Halevy
[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
Signed-off-by: Benny Halevy
Signed-off-by: Trond Myklebust -
[moved nfs4_get_renew_cred related changes to
"nfs41: introduce get_state_renewal_cred"]
Signed-off-by: Benny Halevy
Signed-off-by: Trond Myklebust -
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
Signed-off-by: Benny Halevy[nfs41: session reset in nfs4_recovery_handle_error]
Signed-off-by: Andy Adamson
[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
Signed-off-by: Benny Halevy
[move nfs4_proc_destroy_session declaration here]
Signed-off-by: Benny Halevy
Signed-off-by: Trond Myklebust -
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
Signed-off-by: Benny Halevy[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
Signed-off-by: Benny Halevy[nfs41: rename NFS_CS_SESSION_SETUP to NFS_CS_SESSION_INITING]
Signed-off-by: Andy Adamson
[nfs41: set NFS_CL_SESSION_INITING in alloc_session]
Signed-off-by: Andy Adamson
[nfs41: move session setup into a function]
Signed-off-by: Andy Adamson
Signed-off-by: Benny Halevy
[moved nfs4_proc_create_session declaration here]
Signed-off-by: Benny Halevy
Signed-off-by: Trond Myklebust