* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2014 Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* The OBD Filter Device (OFD) module belongs to the Object Storage
* Server stack and connects the RPC oriented Unified Target (TGT)
* layer (see lustre/include/lu_target.h) to the storage oriented OSD
- * layer (see lustre/doc/osd-api.txt).
+ * layer (see Documentation/osd-api.txt).
*
* TGT
* | DT and OBD APIs
struct lu_device *d;
struct ofd_thread_info *info = ofd_info(env);
struct lustre_mount_info *lmi;
+ struct lustre_mount_data *lmd;
int rc;
char *osdname;
RETURN(-ENODEV);
}
+ lmd = s2lsi(lmi->lmi_sb)->lsi_lmd;
+ if (lmd != NULL && lmd->lmd_flags & LMD_FLG_SKIP_LFSCK)
+ m->ofd_skip_lfsck = 1;
+
/* find bottom osd */
OBD_ALLOC(osdname, MTI_NAME_MAXLEN);
if (osdname == NULL)
struct lustre_handle lh = { 0 };
struct ofd_object *fo;
__u64 flags = 0;
- ldlm_mode_t lock_mode = LCK_PR;
+ enum ldlm_mode lock_mode = LCK_PR;
bool srvlock;
int rc;
ENTRY;
struct ofd_seq *oseq;
int rc = 0, diff;
int sync_trans = 0;
+ long granted = 0;
ENTRY;
if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
!(oa->o_flags & OBD_FL_DELORPHAN)) {
/* don't enforce grant during orphan recovery */
- rc = ofd_grant_create(tsi->tsi_env,
- ofd_obd(ofd)->obd_self_export,
- &diff);
- if (rc) {
+ granted = ofd_grant_create(tsi->tsi_env,
+ ofd_obd(ofd)->obd_self_export,
+ &diff);
+ if (granted < 0) {
+ rc = granted;
+ granted = 0;
CDEBUG(D_HA, "%s: failed to acquire grant "
"space for precreate (%d): rc = %d\n",
ofd_name(ofd), diff, rc);
* LFSCK will eventually clean up any orphans. LU-14 */
if (diff > 5 * OST_MAX_PRECREATE) {
diff = OST_MAX_PRECREATE / 2;
- LCONSOLE_WARN("%s: precreate FID "DOSTID" is over %u "
- "larger than the LAST_ID "DOSTID", only "
- "precreating the last %u objects.\n",
- ofd_name(ofd), POSTID(&oa->o_oi),
- 5 * OST_MAX_PRECREATE,
- POSTID(&oseq->os_oi), diff);
+ LCONSOLE_WARN("%s: Too many FIDs to precreate "
+ "OST replaced or reformatted: "
+ "LFSCK will clean up",
+ ofd_name(ofd));
+
+ CDEBUG(D_HA, "%s: precreate FID "DOSTID" is over "
+ "%u larger than the LAST_ID "DOSTID", only "
+ "precreating the last %u objects.\n",
+ ofd_name(ofd), POSTID(&oa->o_oi),
+ 5 * OST_MAX_PRECREATE,
+ POSTID(&oseq->os_oi), diff);
ofd_seq_last_oid_set(oseq, ostid_id(&oa->o_oi) - diff);
}
ofd_name(ofd), rc);
if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
- !(oa->o_flags & OBD_FL_DELORPHAN))
- ofd_grant_commit(tsi->tsi_env,
- ofd_obd(ofd)->obd_self_export, rc);
+ !(oa->o_flags & OBD_FL_DELORPHAN)) {
+ ofd_grant_commit(ofd_obd(ofd)->obd_self_export, granted,
+ rc);
+ granted = 0;
+ }
ostid_set_id(&rep_oa->o_oi, ofd_seq_last_oid(oseq));
}
LDLM_LOCK_PUT(lock);
RETURN(lock_count);
}
+ lock->l_last_used = cfs_time_current();
LDLM_LOCK_PUT(lock);
}
}
LASSERT(lock->l_flags & LDLM_FL_AST_SENT);
LASSERT(lock->l_resource->lr_type == LDLM_EXTENT);
+ /* ignore waiting locks, no more granted locks in the list */
+ if (lock->l_granted_mode != lock->l_req_mode)
+ break;
+
if (!ldlm_res_eq(&tsi->tsi_resid, &lock->l_resource->lr_name))
continue;
static int ofd_rw_hpreq_lock_match(struct ptlrpc_request *req,
struct ldlm_lock *lock)
{
- struct niobuf_remote *rnb;
- struct obd_ioobj *ioo;
- ldlm_mode_t mode;
- struct ldlm_extent ext;
- __u32 opc = lustre_msg_get_opc(req->rq_reqmsg);
+ struct niobuf_remote *rnb;
+ struct obd_ioobj *ioo;
+ enum ldlm_mode mode;
+ struct ldlm_extent ext;
+ __u32 opc = lustre_msg_get_opc(req->rq_reqmsg);
ENTRY;
.tos_hs = tgt_lfsck_handlers
},
{
+ .tos_opc_start = SEC_FIRST_OPC,
+ .tos_opc_end = SEC_LAST_OPC,
+ .tos_hs = tgt_sec_ctx_handlers
+ },
+ {
.tos_hs = NULL
}
};
info = ofd_info_init(env, NULL);
if (info == NULL)
- RETURN(-EFAULT);
+ GOTO(err_fini_proc, rc = -EFAULT);
rc = ofd_stack_init(env, m, cfg);
if (rc) {
if (rc != 0)
GOTO(err_fini_fs, rc);
+ tgt_adapt_sptlrpc_conf(&m->ofd_lut, 1);
+
RETURN(0);
err_fini_fs:
stop.ls_flags = 0;
lfsck_stop(env, m->ofd_osd, &stop);
target_recovery_fini(obd);
+ if (m->ofd_namespace != NULL)
+ ldlm_namespace_free_prior(m->ofd_namespace, NULL,
+ d->ld_obd->obd_force);
+
obd_exports_barrier(obd);
obd_zombie_barrier();
ofd_fs_cleanup(env, m);
if (m->ofd_namespace != NULL) {
- ldlm_namespace_free(m->ofd_namespace, NULL,
- d->ld_obd->obd_force);
+ ldlm_namespace_free_post(m->ofd_namespace);
d->ld_obd->obd_namespace = m->ofd_namespace = NULL;
}
class_unregister_type(LUSTRE_OST_NAME);
}
-MODULE_AUTHOR("Intel Corporation. <https://www.hpdd.intel.com/>");
+MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
MODULE_DESCRIPTION("Lustre Object Filtering Device");
+MODULE_VERSION(LUSTRE_VERSION_STRING);
MODULE_LICENSE("GPL");
module_init(ofd_init);