Skip to content
Snippets Groups Projects
Commit 1dda8fc2 authored by Bobi Jam's avatar Bobi Jam
Browse files

Branch HEAD

b=13715
i=johann
i=nathan
i=adilger

protect accessing imp->generation w/ imp_lock.
parent 52de126e
No related merge requests found
...@@ -163,15 +163,12 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt) ...@@ -163,15 +163,12 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt)
return rc; return rc;
} }
/* /* Must be called with imp_lock held! */
* This acts as a barrier; all existing requests are rejected, and static void ptlrpc_deactivate_and_unlock_import(struct obd_import *imp)
* no new requests will be accepted until the import is valid again.
*/
void ptlrpc_deactivate_import(struct obd_import *imp)
{ {
ENTRY; ENTRY;
LASSERT_SPIN_LOCKED(&imp->imp_lock);
spin_lock(&imp->imp_lock);
if (imp->imp_invalid) { if (imp->imp_invalid) {
spin_unlock(&imp->imp_lock); spin_unlock(&imp->imp_lock);
EXIT; EXIT;
...@@ -189,6 +186,16 @@ void ptlrpc_deactivate_import(struct obd_import *imp) ...@@ -189,6 +186,16 @@ void ptlrpc_deactivate_import(struct obd_import *imp)
EXIT; EXIT;
} }
/*
* This acts as a barrier; all existing requests are rejected, and
* no new requests will be accepted until the import is valid again.
*/
void ptlrpc_deactivate_import(struct obd_import *imp)
{
spin_lock(&imp->imp_lock);
ptlrpc_deactivate_and_unlock_import(imp);
}
/* /*
* This function will invalidate the import, if necessary, then block * This function will invalidate the import, if necessary, then block
* for all the RPC completions, and finally notify the obd to * for all the RPC completions, and finally notify the obd to
...@@ -805,9 +812,12 @@ finish: ...@@ -805,9 +812,12 @@ finish:
out: out:
if (rc != 0) { if (rc != 0) {
IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON); IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON);
spin_lock(&imp->imp_lock);
if (aa->pcaa_initial_connect && !imp->imp_initial_recov && if (aa->pcaa_initial_connect && !imp->imp_initial_recov &&
(request->rq_import_generation == imp->imp_generation)) (request->rq_import_generation == imp->imp_generation))
ptlrpc_deactivate_import(imp); ptlrpc_deactivate_and_unlock_import(imp);
else
spin_unlock(&imp->imp_lock);
if ((imp->imp_recon_bk && imp->imp_last_recon) || if ((imp->imp_recon_bk && imp->imp_last_recon) ||
(rc == -EACCES)) { (rc == -EACCES)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment