import_set_state_nolock(imp, LUSTRE_IMP_DISCON);
if (rc == -EACCES || rc == -EROFS) {
/*
- * Give up trying to reconnect
- * EACCES means client has no permission for connection
- * EROFS means client must mount read-only
+ * -EACCES means client has no permission for connection
+ * -EROFS means client must mount read-only
+ * Client deactivates import, it can be activated back
+ * manually when issue is resolved
+ * Server keeps trying forever until reconfigured or
+ * unmounted
*/
- imp->imp_obd->obd_no_recov = 1;
- ptlrpc_deactivate_import_nolock(imp);
- inact = true;
+ LCONSOLE_WARN("%s: connection denied by %s: rc = %d\n",
+ imp->imp_obd->obd_name,
+ obd2cli_tgt(imp->imp_obd), rc);
+ if (imp->imp_connect_flags_orig &
+ (OBD_CONNECT_LIGHTWEIGHT |
+ OBD_CONNECT_MDS_MDS | OBD_CONNECT_MDS)) {
+ /* consider LWP, MDT-MDT and MDT-OST access
+ * errors as temporary
+ */
+ rc = -EAGAIN;
+ imp->imp_force_reconnect = 1;
+ } else {
+ imp->imp_deactive = 1;
+ ptlrpc_deactivate_import_nolock(imp);
+ inact = true;
+ }
} else if (rc == -EPROTO) {
struct obd_connect_data *ocd;
OBD_OCD_VERSION_PATCH(ocd->ocd_version),
OBD_OCD_VERSION_FIX(ocd->ocd_version),
LUSTRE_VERSION_STRING);
+ imp->imp_deactive = 1;
ptlrpc_deactivate_import_nolock(imp);
import_set_state_nolock(imp, LUSTRE_IMP_CLOSED);
inact = true;
(request->rq_deadline - request->rq_sent);
spin_unlock(&imp->imp_lock);
- if (inact)
+ if (inact) {
+ /* imp_deactive event */
+ obd_import_event(imp->imp_obd, imp,
+ IMP_EVENT_DEACTIVATE);
+ /* imp_invalid event */
obd_import_event(imp->imp_obd, imp, IMP_EVENT_INACTIVE);
+ /* evict and invalidate if reconnect */
+ if (!aa->pcaa_initial_connect) {
+ import_set_state(imp, LUSTRE_IMP_EVICTED);
+ ptlrpc_import_recovery_state_machine(imp);
+ }
+ }
if (rc == -EPROTO)
RETURN(rc);
}
run_test 157 "eviction during mmaped i/o"
+cleanup_158() {
+ do_facet mds2 $LCTL set_param fail_loc=0
+ zconf_umount_clients $CLIENTS $MOUNT
+ mountcli
+}
+
+test_158a() {
+ (( $MDS1_VERSION >= $(version_code 2.15.62) )) ||
+ skip "Need MDS version at least 2.15.62 for -EACCES fix"
+ (( MDSCOUNT > 1 )) || skip "needs >= 2 MDTS"
+
+ remount_client $MOUNT
+ # ensure there is no MOUNT2 on clients
+ zconf_umount_clients $CLIENTS $MOUNT2 -f
+
+ stack_trap cleanup_158 EXIT RETURN
+
+ # client import is evicted after failover followed by -EACCES
+ #define OBD_FAIL_MDS_CONNECT_ACCESS 0x2402
+ do_facet mds2 $LCTL set_param fail_loc=0x2402
+ fail_nodf mds2
+ sleep 5
+ $LFS df $MOUNT
+ do_facet mds2 $LCTL set_param fail_loc=0
+ wait_recovery_complete mds2 || error "MDS recovery not done"
+ sleep 5
+
+ local mdc2=$($LCTL dl | awk '/mdc.*MDT0001-mdc*/ { print $4}')
+ local active=$($LCTL get_param -n mdc.$mdc2.active)
+ (( active == 0 )) || error "import status is 'active'"
+ $LCTL --device $mdc2 activate
+ active=$($LCTL get_param -n mdc.$mdc2.active)
+ (( active == 1 )) || error "import status is not 'active'"
+ status=$($LFS check mdts | grep $mdc2 | grep -c active)
+ (( status == 1 )) || {
+ $LFS check mdts
+ error "import is not operational"
+ }
+}
+run_test 158a "connect without access right"
+
complete_test $SECONDS
check_and_cleanup_lustre
exit_status