request->rq_replen = lustre_msg_size(1, &size);
- rc = ptlrpc_queue_wait(request);
- if (rc)
- GOTO(out, rc);
-
- body = lustre_swab_repbuf(request, 0, sizeof(*body),
- lustre_swab_ost_body);
- if (body == NULL)
- GOTO(out, rc = -EPROTO);
+ if (oti != NULL && (oti->oti_flags & OBD_MODE_ASYNC)) {
+ ptlrpcd_add_req(request);
+ rc = 0;
+ } else {
+ rc = ptlrpc_queue_wait(request);
+ if (rc)
+ GOTO(out, rc);
- memcpy(oa, &body->oa, sizeof(*oa));
+ body = lustre_swab_repbuf(request, 0, sizeof(*body),
+ lustre_swab_ost_body);
+ if (body == NULL)
+ GOTO(out, rc = -EPROTO);
+ memcpy(oa, &body->oa, sizeof(*oa));
+ }
EXIT;
out:
ptlrpc_req_finished(request);
int osc_real_create(struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md **ea, struct obd_trans_info *oti)
{
+ struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc;
struct ptlrpc_request *request;
struct ost_body *body;
struct lov_stripe_md *lsm;
GOTO (out_req, rc = -EPROTO);
}
+ if ((oa->o_valid & OBD_MD_FLFLAGS) && oa->o_flags == OBD_FL_DELORPHAN) {
+ struct obd_import *imp = class_exp2cliimp(exp);
+ /* MDS declares last known object, OSS responses
+ * with next possible object -bzzz */
+ spin_lock(&oscc->oscc_lock);
+ oscc->oscc_next_id = body->oa.o_id;
+ spin_unlock(&oscc->oscc_lock);
+ CDEBUG(D_HA, "%s: set nextid "LPD64" after recovery\n",
+ imp->imp_target_uuid.uuid, oa->o_id);
+ }
memcpy(oa, &body->oa, sizeof(*oa));
/* This should really be sent by the OST */
}
static int osc_sync(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *md, obd_size start, obd_size end)
+ struct lov_stripe_md *md, obd_size start,
+ obd_size end)
{
struct ptlrpc_request *request;
struct ost_body *body;
memcpy(&body->oa, oa, sizeof(*oa));
request->rq_replen = lustre_msg_size(1, &size);
- if (oti != NULL && oti->oti_async) {
- /* asynchrounous destroy */
+ if (oti != NULL && (oti->oti_flags & OBD_MODE_ASYNC)) {
ptlrpcd_add_req(request);
rc = 0;
} else {
osc_wake_cache_waiters(cli);
osc_check_rpcs(cli);
-
spin_unlock(&cli->cl_loi_list_lock);
obdo_free(aa->aa_oa);
rc = ldlm_lock_match(obd->obd_namespace, 0, &res_id, type, policy, mode,
lockh);
if (rc == 1) {
+ if (ptlrpcs_check_cred(obd->u.cli.cl_import)) {
+ /* return immediately if no credential held */
+ ldlm_lock_decref(lockh, mode);
+ RETURN(-EACCES);
+ }
+
osc_set_data_with_check(lockh, data);
if (*flags & LDLM_FL_HAS_INTENT) {
/* I would like to be able to ASSERT here that rss <=
rc = ldlm_lock_match(obd->obd_namespace, 0, &res_id, type,
policy, LCK_PW, lockh);
if (rc == 1) {
+ if (ptlrpcs_check_cred(obd->u.cli.cl_import)) {
+ /* return immediately if no credential held */
+ ldlm_lock_decref(lockh, LCK_PW);
+ RETURN(-EACCES);
+ }
+
/* FIXME: This is not incredibly elegant, but it might
* be more elegant than adding another parameter to
* lock_match. I want a second opinion. */
}
static int osc_cancel_unused(struct obd_export *exp,
- struct lov_stripe_md *lsm, int flags, void *opaque)
+ struct lov_stripe_md *lsm,
+ int flags, void *opaque)
{
struct obd_device *obd = class_exp2obd(exp);
struct ldlm_res_id res_id = { .name = {0} }, *resp = NULL;
int rc = 0;
ENTRY;
- if (keylen == strlen("next_id") &&
- memcmp(key, "next_id", strlen("next_id")) == 0) {
- if (vallen != sizeof(obd_id))
- RETURN(-EINVAL);
- obd->u.cli.cl_oscc.oscc_next_id = *((obd_id*)val) + 1;
- CDEBUG(D_HA, "%s: set oscc_next_id = "LPU64"\n",
- exp->exp_obd->obd_name,
- obd->u.cli.cl_oscc.oscc_next_id);
-
- RETURN(0);
- }
-
- if (keylen == strlen("growth_count") &&
- memcmp(key, "growth_count", strlen("growth_count")) == 0) {
- if (vallen != sizeof(int))
- RETURN(-EINVAL);
- obd->u.cli.cl_oscc.oscc_max_grow_count = *((int*)val);
- RETURN(0);
- }
-
if (keylen == strlen("unlinked") &&
memcmp(key, "unlinked", keylen) == 0) {
struct osc_creator *oscc = &obd->u.cli.cl_oscc;
RETURN(0);
}
- if (keylen == strlen("async") && memcmp(key, "async", keylen) == 0) {
+ if (keylen == strlen("async") &&
+ memcmp(key, "async", keylen) == 0) {
struct client_obd *cl = &obd->u.cli;
if (vallen != sizeof(int))
RETURN(-EINVAL);
RETURN(0);
}
- if (keylen == strlen("sec") && memcmp(key, "sec", keylen) == 0) {
+ if (keylen == strlen("sec") &&
+ memcmp(key, "sec", keylen) == 0) {
struct client_obd *cli = &exp->exp_obd->u.cli;
if (vallen == strlen("null") &&
RETURN(-EINVAL);
}
- if (keylen < strlen("mds_conn") || memcmp(key, "mds_conn", keylen) != 0)
+ if (keylen == strlen("flush_cred") &&
+ memcmp(key, "flush_cred", keylen) == 0) {
+ struct client_obd *cli = &exp->exp_obd->u.cli;
+
+ if (cli->cl_import)
+ ptlrpcs_import_flush_creds(cli->cl_import,
+ *((uid_t *) val));
+ RETURN(0);
+ }
+
+ if (keylen < strlen("mds_conn") ||
+ memcmp(key, "mds_conn", keylen) != 0)
RETURN(-EINVAL);
- ctxt = llog_get_context(&exp->exp_obd->obd_llogs, LLOG_UNLINK_ORIG_CTXT);
+ ctxt = llog_get_context(&exp->exp_obd->obd_llogs,
+ LLOG_UNLINK_ORIG_CTXT);
if (ctxt) {
if (rc == 0)
rc = llog_initiator_connect(ctxt);
else
- CERROR("cannot establish the connect for ctxt %p: %d\n",
- ctxt, rc);
+ CERROR("cannot establish the connect for "
+ "ctxt %p: %d\n", ctxt, rc);
}
imp->imp_server_timeout = 1;
};
static struct llog_operations osc_unlink_orig_logops;
+
static int osc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
struct obd_device *tgt, int count,
struct llog_catid *catid)
RETURN(rc);
}
-
static int osc_connect(struct lustre_handle *exph,
struct obd_device *obd, struct obd_uuid *cluuid,
struct obd_connect_data *data,