#define OBD_FAIL_OBD_ZERO_NLINK_RACE 0x60b
#define OBD_FAIL_OBD_STOP_MDS_RACE 0x60c
#define OBD_FAIL_OBD_SETUP 0x60d
+#define OBD_FAIL_OBD_CLEANUP 0x60e
#define OBD_FAIL_TGT_REPLY_NET 0x700
#define OBD_FAIL_TGT_CONN_RACE 0x701
client_common_put_super(sb);
}
+ /* imitate failed cleanup */
+ if (OBD_FAIL_CHECK(OBD_FAIL_OBD_CLEANUP))
+ goto skip_cleanup;
+
next = 0;
while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)))
class_manual_cleanup(obd);
+skip_cleanup:
if (test_bit(LL_SBI_VERBOSE, sbi->ll_flags))
LCONSOLE_WARN("Unmounted %s\n", profilenm ? profilenm : "");
if (lmv->lmv_tgts_kobj)
kobject_put(lmv->lmv_tgts_kobj);
- if (!lmv->connected)
- class_export_put(exp);
- rc = class_disconnect(exp);
lmv->connected = 0;
+ rc = class_disconnect(exp);
RETURN(rc);
}
ENTRY;
fld_client_fini(&lmv->lmv_fld);
+ fld_client_debugfs_fini(&lmv->lmv_fld);
+
+ lprocfs_obd_cleanup(obd);
+ lprocfs_free_md_stats(obd);
+
lmv_foreach_tgt_safe(lmv, tgt, tmp)
lmv_del_target(lmv, tgt);
lu_tgt_descs_fini(&lmv->lmv_mdt_descs);
{
ENTRY;
libcfs_kkuc_group_rem(&obd->obd_uuid, 0, KUC_GRP_HSM);
- fld_client_debugfs_fini(&obd->u.lmv.lmv_fld);
- lprocfs_obd_cleanup(obd);
- lprocfs_free_md_stats(obd);
RETURN(0);
}
goto out;
/* Only disconnect the underlying layers on the final disconnect. */
+ if (lov->lov_connects == 0) {
+ CWARN("%s: was disconnected already #%d\n",
+ obd->obd_name, lov->lov_connects);
+ RETURN(0);
+ }
+
lov->lov_connects--;
- if (lov->lov_connects != 0) {
+ if (lov->lov_connects > 0) {
/* why should there be more than 1 connect? */
CWARN("%s: unexpected disconnect #%d\n",
obd->obd_name, lov->lov_connects);
ENTRY;
osc_precleanup_common(obd);
- mdc_changelog_cdev_finish(obd);
- obd_cleanup_client_import(obd);
- ptlrpc_lprocfs_unregister_obd(obd);
- lprocfs_free_md_stats(obd);
+ mdc_changelog_cdev_finish(obd);
mdc_llog_finish(obd);
+ lprocfs_free_md_stats(obd);
+ ptlrpc_lprocfs_unregister_obd(obd);
+
RETURN(0);
}
}
run_test 171 "test libcfs_debug_dumplog_thread stuck in do_exit() ======"
+test_172() {
+
+ #define OBD_FAIL_OBD_CLEANUP 0x60e
+ $LCTL set_param fail_loc=0x60e
+ umount $MOUNT || error "umount $MOUNT failed"
+ stack_trap "mount_client $MOUNT"
+
+ (( $($LCTL dl | egrep -c " osc | lov | lmv | mdc ") > 0 )) ||
+ error "no client OBDs are remained"
+
+ $LCTL dl | while read devno state type name foo; do
+ case $type in
+ lov|osc|lmv|mdc)
+ $LCTL --device $name cleanup
+ $LCTL --device $name detach
+ ;;
+ *)
+ # skip server devices
+ ;;
+ esac
+ done
+
+ if (( $($LCTL dl | egrep -c " osc | lov | lmv | mdc ") > 0 )); then
+ $LCTL dl | egrep " osc | lov | lmv | mdc "
+ error "some client OBDs are still remained"
+ fi
+
+}
+run_test 172 "manual device removal with lctl cleanup/detach ======"
+
# it would be good to share it with obdfilter-survey/iokit-libecho code
setup_obdecho_osc () {
local rc=0