mirror of https://gitee.com/openkylin/linux.git
staging: lustre: simplify ptlrpc_deactivate_and_unlock_import
The locking scheme used in ptlrpc_deactivate_and_unlock_import and ptlrpc_deactivate_import generates the followings sparse errors: drivers/staging/lustre/lustre/ptlrpc/import.c:209:9: warning: context imbalance in 'ptlrpc_deactivate_and_unlock_import' - unexpected unlock drivers/staging/lustre/lustre/ptlrpc/import.c:221:6: warning: context imbalance in 'ptlrpc_deactivate_import' - wrong count at exit As ptlrpc_deactivate_and_unlock_import is only used by ptlrpc_deactivate_import as a helper function, this patch moves its code into ptlrpc_deactivatre_import to fix the sparse warnings. Signed-off-by: Maxime Lorrillere <maxime.lorrillere@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6ff33f3902
commit
441fda8461
|
@ -200,28 +200,21 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be called with imp_lock held! */
|
|
||||||
static void ptlrpc_deactivate_and_unlock_import(struct obd_import *imp)
|
|
||||||
{
|
|
||||||
assert_spin_locked(&imp->imp_lock);
|
|
||||||
|
|
||||||
CDEBUG(D_HA, "setting import %s INVALID\n", obd2cli_tgt(imp->imp_obd));
|
|
||||||
imp->imp_invalid = 1;
|
|
||||||
imp->imp_generation++;
|
|
||||||
spin_unlock(&imp->imp_lock);
|
|
||||||
|
|
||||||
ptlrpc_abort_inflight(imp);
|
|
||||||
obd_import_event(imp->imp_obd, imp, IMP_EVENT_INACTIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This acts as a barrier; all existing requests are rejected, and
|
* This acts as a barrier; all existing requests are rejected, and
|
||||||
* no new requests will be accepted until the import is valid again.
|
* no new requests will be accepted until the import is valid again.
|
||||||
*/
|
*/
|
||||||
void ptlrpc_deactivate_import(struct obd_import *imp)
|
void ptlrpc_deactivate_import(struct obd_import *imp)
|
||||||
{
|
{
|
||||||
|
CDEBUG(D_HA, "setting import %s INVALID\n", obd2cli_tgt(imp->imp_obd));
|
||||||
|
|
||||||
spin_lock(&imp->imp_lock);
|
spin_lock(&imp->imp_lock);
|
||||||
ptlrpc_deactivate_and_unlock_import(imp);
|
imp->imp_invalid = 1;
|
||||||
|
imp->imp_generation++;
|
||||||
|
spin_unlock(&imp->imp_lock);
|
||||||
|
|
||||||
|
ptlrpc_abort_inflight(imp);
|
||||||
|
obd_import_event(imp->imp_obd, imp, IMP_EVENT_INACTIVE);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ptlrpc_deactivate_import);
|
EXPORT_SYMBOL(ptlrpc_deactivate_import);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue