#define LP_POISON ((void *)LL_POISON)
#ifdef HAVE_SERVER_SUPPORT
-void target_client_add_cb(struct obd_device *obd, __u64 transno, void *cb_data,
- int error);
int rev_import_init(struct obd_export *exp);
int target_handle_connect(struct ptlrpc_request *req);
int target_handle_disconnect(struct ptlrpc_request *req);
#define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
#define OBD_FAIL_TGT_MOUNT_RACE 0x716
#define OBD_FAIL_TGT_REPLAY_TIMEOUT 0x717
+#define OBD_FAIL_TGT_CLIENT_DEL 0x718
+#define OBD_FAIL_TGT_SLUGGISH_NET 0x719
#define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800
#define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
RETURN(EALREADY);
}
-void target_client_add_cb(struct obd_device *obd, __u64 transno, void *cb_data,
- int error)
-{
- struct obd_export *exp = cb_data;
-
- CDEBUG(D_RPCTRACE, "%s: committing for initial connect of %s\n",
- obd->obd_name, exp->exp_client_uuid.uuid);
-
- spin_lock(&exp->exp_lock);
- exp->exp_need_sync = 0;
- spin_unlock(&exp->exp_lock);
- class_export_cb_put(exp);
-}
-
static void
check_and_start_recovery_timer(struct obd_device *obd,
struct ptlrpc_request *req, int new_client);
to = drt;
}
- if (to > obd->obd_recovery_time_hard)
- to = obd->obd_recovery_time_hard;
+ if (to > obd->obd_recovery_time_hard) {
+ to = obd->obd_recovery_time_hard;
+ CWARN("%s: extended recovery timer reaching hard "
+ "limit: %d, extend: %d\n",
+ obd->obd_name, to, extend);
+ }
+
if (obd->obd_recovery_timeout < to) {
obd->obd_recovery_timeout = to;
end = obd->obd_recovery_start + to;
* and reuse service_time to limit stack usage. */
service_time = at_est2timeout(service_time);
+ if (OBD_FAIL_CHECK(OBD_FAIL_TGT_SLUGGISH_NET) &&
+ service_time < at_extra)
+ service_time = at_extra;
+
/* We expect other clients to timeout within service_time, then try
* to reconnect, then try the failover server. The max delay between
* connect attempts is SWITCH_MAX + SWITCH_INC + INITIAL. */
if (has_ir) {
int new_soft = soft;
- int new_hard = hard;
/* adjust timeout value by imperative recovery */
-
new_soft = (soft * factor) / OBD_IR_FACTOR_MAX;
- new_hard = (hard * factor) / OBD_IR_FACTOR_MAX;
-
/* make sure the timeout is not too short */
new_soft = max(min, new_soft);
- new_hard = max(new_soft, new_hard);
LCONSOLE_INFO("%s: Imperative Recovery enabled, recovery "
"window shrunk from %d-%d down to %d-%d\n",
- obd->obd_name, soft, hard, new_soft, new_hard);
+ obd->obd_name, soft, hard, new_soft, hard);
soft = new_soft;
- hard = new_hard;
+ } else {
+ LCONSOLE_INFO("%s: Imperative Recovery not enabled, recovery "
+ "window %d-%d\n", obd->obd_name, soft, hard);
}
/* we're done */
if (!(lsd->lsd_feature_compat & OBD_COMPAT_OST)) {
/* this will only happen on the first connect */
lsd->lsd_feature_compat |= OBD_COMPAT_OST;
- /* sync is not needed here as lut_client_add will
+ /* sync is not needed here as tgt_client_new will
* set exp_need_sync flag */
tgt_server_data_update(env, &ofd->ofd_lut, 0);
}
OBD_FREE_PTR(ccb);
}
+/**
+ * Add commit callback function, it returns a non-zero value to inform
+ * caller to use sync transaction if necessary.
+ */
int tgt_last_commit_cb_add(struct thandle *th, struct lu_target *tgt,
struct obd_export *exp, __u64 transno)
{
/* report failure to force synchronous operation */
return -EPERM;
- return rc;
+ /* if exp_need_sync is set, return non-zero value to force
+ * a sync transaction. */
+ return rc ? rc : exp->exp_need_sync;
}
struct tgt_new_client_callback {
if (exp->exp_flags & OBD_OPT_FAILOVER)
RETURN(0);
+ if (OBD_FAIL_CHECK(OBD_FAIL_TGT_CLIENT_DEL))
+ RETURN(0);
+
/* Make sure the server's last_transno is up to date.
* This should be done before zeroing client slot so last_transno will
* be in server data or in client data in case of failure */
}
run_test 12a "lost data due to missed REMOTE client during replay"
+test_13() { # LU-8826
+ local var=${SINGLEMDS}_svc
+
+ if combined_mgs_mds ; then
+ skip "Needs separate MGS to enable IR"
+ return 0
+ fi
+
+ do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
+ zconf_mount $CLIENT2 $MOUNT2
+ do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
+
+ # set ir_timeout to a reasonable small value
+ local ir_timeout=$(do_facet mgs $LCTL get_param -n mgs.*.ir_timeout)
+ do_facet mgs $LCTL set_param mgs.*.ir_timeout=5
+ # make sure IR functional
+ sleep 5
+
+ replay_barrier $SINGLEMDS
+ do_node $CLIENT1 chmod 666 $DIR/$tfile
+ do_node $CLIENT2 chmod 777 $DIR2/$tfile
+
+ # make sure client data of $CLIENT2:$MOUNT2 is remained
+ # define OBD_FAIL_TGT_CLIENT_DEL 0x718
+ do_facet $SINGLEMDS $LCTL set_param fail_loc=0x718
+ zconf_umount $CLIENT2 $MOUNT2
+ # define OBD_FAIL_TGT_SLUGGISH_NET 0x719
+ do_facet $SINGLEMDS $LCTL set_param fail_loc=0x719
+ facet_failover $SINGLEMDS
+
+ client_up $CLIENT1 || error "$CLIENT1 evicted"
+
+ do_facet $SINGLEMDS $LCTL set_param fail_loc=0
+ do_facet mgs $LCTL set_param mgs.*.ir_timeout=$ir_timeout
+
+ do_node $CLIENT1 $CHECKSTAT -p 0666 $DIR/$tfile ||
+ error "$DIR/$tfile-a: unexpected state"
+}
+run_test 13 "Shouldn't give up VBR easily on sluggish network"
+
#restore COS setting
restore_lustre_params < $cos_param_file
rm -f $cos_param_file