X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fofd%2Fofd_dev.c;h=ae96044ac67b01a1f79a6a55e639ef5c5bbaffc2;hb=f6dc0994f2bb5d2624e622213b634e74a1c76e3f;hp=6782e5dc6908b39030a701760492b6285952d354;hpb=b6a1b9470e7acccd731d97b7c9409a9f61befb0c;p=fs%2Flustre-release.git diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 6782e5d..ae96044 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -81,7 +81,7 @@ static int ofd_connect_to_next(const struct lu_env *env, struct ofd_device *m, obd = class_name2obd(next); if (obd == NULL) { CERROR("%s: can't locate next device: %s\n", - m->ofd_dt_dev.dd_lu_dev.ld_obd->obd_name, next); + ofd_name(m), next); GOTO(out, rc = -ENOTCONN); } @@ -91,7 +91,7 @@ static int ofd_connect_to_next(const struct lu_env *env, struct ofd_device *m, rc = obd_connect(NULL, exp, obd, &obd->obd_uuid, data, NULL); if (rc) { CERROR("%s: cannot connect to next dev %s: rc = %d\n", - m->ofd_dt_dev.dd_lu_dev.ld_obd->obd_name, next, rc); + ofd_name(m), next, rc); GOTO(out, rc); } @@ -182,7 +182,6 @@ static void ofd_stack_fini(const struct lu_env *env, struct ofd_device *m, LASSERT(m->ofd_osd_exp); obd_disconnect(m->ofd_osd_exp); - m->ofd_osd = NULL; EXIT; } @@ -362,7 +361,7 @@ static struct lu_object *ofd_object_alloc(const struct lu_env *env, ENTRY; - OBD_SLAB_ALLOC_PTR_GFP(of, ofd_object_kmem, __GFP_IO); + OBD_SLAB_ALLOC_PTR_GFP(of, ofd_object_kmem, GFP_NOFS); if (of != NULL) { struct lu_object *o; struct lu_object_header *h; @@ -406,7 +405,7 @@ static int ofd_lfsck_out_notify(const struct lu_env *env, void *data, } default: CERROR("%s: unknown lfsck event: rc = %d\n", - ofd_obd(ofd)->obd_name, event); + ofd_name(ofd), event); return -EINVAL; } @@ -420,7 +419,6 @@ static int ofd_prepare(const struct lu_env *env, struct lu_device *pdev, struct ofd_device *ofd = ofd_dev(dev); struct obd_device *obd = ofd_obd(ofd); struct lu_device *next = &ofd->ofd_osd->dd_lu_dev; - struct lfsck_start_param lsp; int rc; ENTRY; @@ -442,15 +440,10 @@ static int ofd_prepare(const struct lu_env *env, struct lu_device *pdev, RETURN(rc); } - lsp.lsp_namespace = ofd->ofd_namespace; - lsp.lsp_start = NULL; - lsp.lsp_index_valid = 0; - rc = lfsck_start(env, ofd->ofd_osd, &lsp); - if (rc != 0) { - CWARN("%s: auto trigger paused LFSCK failed: rc = %d\n", - obd->obd_name, rc); - rc = 0; - } + rc = lfsck_register_namespace(env, ofd->ofd_osd, ofd->ofd_namespace); + /* The LFSCK instance is registered just now, so it must be there when + * register the namespace to such instance. */ + LASSERTF(rc == 0, "register namespace failed: rc = %d\n", rc); target_recovery_init(&ofd->ofd_lut, tgt_request_handle); LASSERT(obd->obd_no_conn); @@ -1168,6 +1161,9 @@ static int ofd_orphans_destroy(const struct lu_env *env, LASSERT(exp != NULL); skip_orphan = !!(exp_connect_flags(exp) & OBD_CONNECT_SKIP_ORPHAN); + if (OBD_FAIL_CHECK(OBD_FAIL_OST_NODESTROY)) + goto done; + LCONSOLE(D_INFO, "%s: deleting orphan objects from "DOSTID " to "DOSTID"\n", ofd_name(ofd), seq, end_id + 1, seq, last); @@ -1177,9 +1173,12 @@ static int ofd_orphans_destroy(const struct lu_env *env, GOTO(out_put, rc); rc = ofd_destroy_by_fid(env, ofd, fid, 1); - if (rc != 0 && rc != -ENOENT) /* this is pretty fatal... */ - CEMERG("%s: error destroying precreated id "DFID - ": rc = %d\n", ofd_name(ofd), PFID(fid), rc); + if (rc != 0 && rc != -ENOENT && rc != -ESTALE && + likely(rc != -EREMCHG && rc != -EINPROGRESS)) + /* this is pretty fatal... */ + CEMERG("%s: error destroying precreated id " + DFID": rc = %d\n", + ofd_name(ofd), PFID(fid), rc); oid--; if (!skip_orphan) { @@ -1195,7 +1194,9 @@ static int ofd_orphans_destroy(const struct lu_env *env, CDEBUG(D_HA, "%s: after destroy: set last_id to "DOSTID"\n", ofd_name(ofd), seq, oid); +done: if (!skip_orphan) { + ofd_seq_last_oid_set(oseq, oid); rc = ofd_seq_last_oid_write(env, ofd, oseq); } else { /* don't reuse orphan object, return last used objid */ @@ -1553,7 +1554,8 @@ static int ofd_sync_hdl(struct tgt_session_info *tsi) } rc = tgt_sync(tsi->tsi_env, tsi->tsi_tgt, - fo != NULL ? ofd_object_child(fo) : NULL); + fo != NULL ? ofd_object_child(fo) : NULL, + repbody->oa.o_size, repbody->oa.o_blocks); if (rc) GOTO(put, rc); @@ -1652,7 +1654,7 @@ static int ofd_punch_hdl(struct tgt_session_info *tsi) } rc = ofd_object_punch(tsi->tsi_env, fo, start, end, &info->fti_attr, - ff); + ff, (struct obdo *)oa); if (rc) GOTO(out_put, rc); @@ -2059,8 +2061,8 @@ static struct tgt_opc_slice ofd_common_slice[] = { .tos_hs = tgt_dlm_handlers }, { - .tos_opc_start = UPDATE_OBJ, - .tos_opc_end = UPDATE_LAST_OPC, + .tos_opc_start = OUT_UPDATE_FIRST_OPC, + .tos_opc_end = OUT_UPDATE_LAST_OPC, .tos_hs = tgt_out_handlers }, { @@ -2124,6 +2126,9 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m, m->ofd_tot_granted = 0; m->ofd_tot_pending = 0; m->ofd_seq_count = 0; + init_waitqueue_head(&m->ofd_inconsistency_thread.t_ctl_waitq); + INIT_LIST_HEAD(&m->ofd_inconsistency_list); + spin_lock_init(&m->ofd_inconsistency_lock); spin_lock_init(&m->ofd_batch_lock); rwlock_init(&obd->u.filter.fo_sptlrpc_lock); @@ -2228,7 +2233,14 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m, if (rc) GOTO(err_fini_lut, rc); + rc = ofd_start_inconsistency_verification_thread(m); + if (rc != 0) + GOTO(err_fini_fs, rc); + RETURN(0); + +err_fini_fs: + ofd_fs_cleanup(env, m); err_fini_lut: tgt_fini(env, &m->ofd_lut); err_free_ns: @@ -2250,12 +2262,13 @@ static void ofd_fini(const struct lu_env *env, struct ofd_device *m) stop.ls_status = LS_PAUSED; stop.ls_flags = 0; lfsck_stop(env, m->ofd_osd, &stop); - lfsck_degister(env, m->ofd_osd); target_recovery_fini(obd); obd_exports_barrier(obd); obd_zombie_barrier(); tgt_fini(env, &m->ofd_lut); + ofd_stop_inconsistency_verification_thread(m); + lfsck_degister(env, m->ofd_osd); ofd_fs_cleanup(env, m); ofd_free_capa_keys(m); @@ -2270,7 +2283,7 @@ static void ofd_fini(const struct lu_env *env, struct ofd_device *m) ofd_stack_fini(env, m, &m->ofd_dt_dev.dd_lu_dev); ofd_procfs_fini(m); LASSERT(atomic_read(&d->ld_ref) == 0); - server_put_mount(obd->obd_name); + server_put_mount(obd->obd_name, true); EXIT; } @@ -2379,11 +2392,11 @@ int __init ofd_init(void) lprocfs_ofd_init_vars(&lvars); - rc = class_register_type(&ofd_obd_ops, NULL, NULL, + rc = class_register_type(&ofd_obd_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ - lvars.module_vars, + lvars.module_vars, #endif - LUSTRE_OST_NAME, &ofd_device_type); + LUSTRE_OST_NAME, &ofd_device_type); return rc; }