- added canceling unused locks before disconnecting master/cache exports in cobd_iocontrol()
- added lmv_cancel_unused() to cancel unused locks from llite correctly instead of using
direct ldlm_cli_cancel_unused() on lmv namespace.
- removed not used ll_mdc_cancel_unused()
cobd->master_exp = class_conn2export(&conn);
- /* getting master obd */
+ /* getting cache obd */
cache_obd = class_name2obd(cobd->cache_name);
if (!cache_obd) {
class_disconnect(cobd->master_exp, 0);
GOTO(put_names, rc);
}
- /* connecting master */
+ /* connecting cache */
memset(&conn, 0, sizeof(conn));
rc = class_connect(&conn, cache_obd, &obd->obd_uuid);
if (rc) {
GOTO(put_names, rc);
}
cobd->cache_exp = class_conn2export(&conn);
- /*default set cache on*/
+
+ /* default set cache on */
cobd->cache_on = 1;
EXIT;
put_names:
return cobd->master_exp;
}
-static int client_obd_connect(struct obd_device *obd, struct obd_export *exp,
- struct lustre_handle *conn,
- struct obd_connect_data *data,
- unsigned long flags)
+static int
+client_obd_connect(struct obd_device *obd,
+ struct obd_export *exp,
+ struct lustre_handle *conn,
+ struct obd_connect_data *data,
+ unsigned long flags)
{
struct obd_device *cli_obd;
int rc = 0;
RETURN(rc);
}
-static int client_obd_disconnect(struct obd_device *obd,
- struct obd_export *exp,
- unsigned long flags)
+static int
+client_obd_disconnect(struct obd_device *obd,
+ struct obd_export *exp,
+ unsigned long flags)
{
struct obd_device *cli_obd;
int rc = 0;
}
static int cobd_cancel_unused(struct obd_export *exp,
- struct lov_stripe_md *ea, int flags,
- void *opaque)
+ struct lov_stripe_md *ea,
+ int flags, void *opaque)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_export *cobd_exp;
return obd_cancel_unused(cobd_exp, ea, flags, opaque);
}
-static int cobd_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
- int objcount, struct obd_ioobj *obj,
- int niocount, struct niobuf_remote *nb,
- struct niobuf_local *res, struct obd_trans_info *oti)
+static int cobd_preprw(int cmd, struct obd_export *exp,
+ struct obdo *oa, int objcount,
+ struct obd_ioobj *obj, int niocount,
+ struct niobuf_remote *nb,
+ struct niobuf_local *res,
+ struct obd_trans_info *oti)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_export *cobd_exp;
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return obd_preprw(cmd, cobd_exp, oa, objcount, obj, niocount, nb,
- res, oti);
+ return obd_preprw(cmd, cobd_exp, oa, objcount, obj,
+ niocount, nb, res, oti);
}
static int cobd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return obd_commitrw(cmd, cobd_exp, oa, objcount, obj, niocount,
- local, oti, rc);
+ return obd_commitrw(cmd, cobd_exp, oa, objcount, obj,
+ niocount, local, oti, rc);
}
static int cobd_flush(struct obd_device *obd)
if (!cobd->cache_on) {
struct lustre_handle conn = {0};
+ rc = obd_cancel_unused(cobd->master_real_exp, NULL,
+ LDLM_FL_COBD_SWITCH, NULL);
+ if (rc) {
+ CWARN("can't cancel unused locks on master export, "
+ "err %d\n", rc);
+ }
+
rc = client_obd_disconnect(obd, cobd->master_real_exp, 0);
+ if (rc) {
+ CWARN("can't disconnect master export, err %d\n",
+ rc);
+ }
+
rc = client_obd_connect(obd, cobd->cache_exp, &conn,
NULL, OBD_OPT_REAL_CLIENT);
if (rc)
GOTO(out, rc);
+
cobd->cache_real_exp = class_conn2export(&conn);
cobd->cache_on = 1;
}
cache = class_exp2obd(cobd->cache_exp);
easize = cache->u.cli.cl_max_mds_easize;
cooksize = cache->u.cli.cl_max_mds_cookiesize;
+
+ rc = obd_cancel_unused(cobd->cache_real_exp, NULL,
+ LDLM_FL_COBD_SWITCH, NULL);
+ if (rc) {
+ CWARN("can't cancel unused locks on cache export, "
+ "err %d\n", rc);
+ }
rc = client_obd_disconnect(obd, cobd->cache_real_exp, 0);
+ if (rc) {
+ CWARN("can't disconnect cache export, err %d\n",
+ rc);
+ }
rc = client_obd_connect(obd, cobd->master_exp, &conn,
NULL, OBD_OPT_REAL_CLIENT);
if (rc)
if (cobd->cache_on) {
cobd->cache_on = 0;
cobd_flush(obd);
+ cobd->cache_on = 1;
} else {
CERROR("%s: cache is turned off\n", obd->obd_name);
}
* indefinitely */
/* file & record locking */
-#define LDLM_FL_BLOCK_NOWAIT 0x040000 // server told not to wait if blocked
-#define LDLM_FL_TEST_LOCK 0x080000 // return blocking lock
+#define LDLM_FL_BLOCK_NOWAIT 0x040000 /* server told not to wait if blocked */
+#define LDLM_FL_TEST_LOCK 0x080000 /* return blocking lock */
+#define LDLM_FL_COBD_SWITCH 0x100000 /* not used yet, but logicaly we have to
+ * distinguish diff. situations. */
/* These are flags that are mapped into the flags and ASTs of blocking locks */
#define LDLM_AST_DISCARD_DATA 0x80000000 /* Add FL_DISCARD to blocking ASTs */
struct inode *ll_iget(struct super_block *sb, ino_t hash,
struct lustre_md *lic);
struct dentry *ll_find_alias(struct inode *, struct dentry *);
-int ll_mdc_cancel_unused(struct lustre_handle *, struct inode *, int flags,
- void *opaque);
int ll_mdc_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
void *data, int flag);
/* llite/rw.c */
}
if (proc_lustre_fs_root) {
- err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
- lov, lmv);
+ err = lprocfs_register_mountpoint(proc_lustre_fs_root,
+ sb, lov, lmv);
if (err < 0)
CERROR("could not register mount in /proc/lustre");
}
sb->s_op = &lustre_super_operations;
- /* make root inode
- * XXX: move this to after cbd setup? */
+ /* make root inode */
err = md_getattr(sbi->ll_md_exp, &sbi->ll_rootid,
- (OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS | OBD_MD_FID), NULL, 0,
- 0, &request);
+ (OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS | OBD_MD_FID),
+ NULL, 0, 0, &request);
if (err) {
CERROR("md_getattr failed for root: rc = %d\n", err);
GOTO(out_lov, err);
GOTO(out, err = -EINVAL);
}
- err = lustre_common_fill_super(sb, lmv, lov, async, sec, nllu,
- &remote_flag);
+ err = lustre_common_fill_super(sb, lmv, lov, async, sec,
+ nllu, &remote_flag);
EXIT;
out:
if (err)
int ll_process_config_update(struct ll_sb_info *sbi, int clean)
{
- struct obd_export *md_exp = sbi->ll_md_exp;
struct lustre_mount_data *lmd = sbi->ll_lmd;
char *profile = lmd->lmd_profile, *name = NULL;
struct config_llog_instance cfg;
if (profile == NULL)
RETURN(0);
if (lmd == NULL) {
- CERROR("Client not mounted with zero-conf; cannot process "
- "update log.\n");
+ CERROR("Client not mounted with zero-conf; cannot "
+ "process update log.\n");
RETURN(0);
}
- rc = ldlm_cli_cancel_unused(md_exp->exp_obd->obd_namespace, NULL,
- LDLM_FL_CONFIG_CHANGE, NULL);
+ rc = obd_cancel_unused(sbi->ll_md_exp, NULL,
+ LDLM_FL_CONFIG_CHANGE, NULL);
if (rc != 0)
- CWARN("ldlm_cli_cancel_unused(mdc): %d\n", rc);
+ CWARN("obd_cancel_unused(mdc): %d\n", rc);
- rc = obd_cancel_unused(sbi->ll_dt_exp, NULL, LDLM_FL_CONFIG_CHANGE,
- NULL);
+ rc = obd_cancel_unused(sbi->ll_dt_exp, NULL,
+ LDLM_FL_CONFIG_CHANGE, NULL);
if (rc != 0)
CWARN("obd_cancel_unused(lov): %d\n", rc);
CWARN("Applying configuration log %s\n", name);
- ctxt = llog_get_context(&md_exp->exp_obd->obd_llogs,
+ ctxt = llog_get_context(&sbi->ll_md_exp->exp_obd->obd_llogs,
LLOG_CONFIG_REPL_CTXT);
rc = class_config_process_llog(ctxt, name, &cfg);
if (rc == 0)
rc = obd_get_info(sbi->ll_dt_exp, strlen("lovdesc") + 1,
"lovdesc", &valsize, &desc);
- rc = obd_init_ea_size(md_exp,
+ rc = obd_init_ea_size(sbi->ll_md_exp,
obd_size_diskmd(sbi->ll_dt_exp, NULL),
(desc.ld_tgt_count *
sizeof(struct llog_cookie)));
RETURN(0);
}
-int ll_mdc_cancel_unused(struct lustre_handle *conn, struct inode *inode,
- int flags, void *opaque)
-{
- struct ll_inode_info *li = ll_i2info(inode);
- struct ldlm_res_id res_id =
- { .name = {id_fid(&li->lli_id), id_group(&li->lli_id)} };
- struct obd_device *obddev = class_conn2obd(conn);
- ENTRY;
-
- RETURN(ldlm_cli_cancel_unused(obddev->obd_namespace, &res_id, flags,
- opaque));
-}
-
/* Search "inode"'s alias list for a dentry that has the same name and parent as
* de. If found, return it. If not found, return de. */
struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
RETURN(err);
}
+static int lmv_cancel_unused(struct obd_export *exp,
+ struct lov_stripe_md *lsm,
+ int flags, void *opaque)
+{
+ struct obd_device *obd = exp->exp_obd;
+ struct lmv_obd *lmv = &obd->u.lmv;
+ int rc = 0, err, i;
+ ENTRY;
+
+ LASSERT(lsm == NULL);
+
+ for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
+ if (!lmv->tgts[i].ltd_exp || !lmv->tgts[i].active)
+ continue;
+
+ err = obd_cancel_unused(lmv->tgts[i].ltd_exp,
+ NULL, flags, opaque);
+ if (!rc)
+ rc = err;
+ }
+ RETURN(rc);
+}
+
struct obd_ops lmv_obd_ops = {
.o_owner = THIS_MODULE,
.o_attach = lmv_attach,
.o_notify = lmv_notify,
.o_iocontrol = lmv_iocontrol,
.o_getready = lmv_getready,
+ .o_cancel_unused = lmv_cancel_unused,
};
struct md_ops lmv_md_ops = {
lov = &exp->exp_obd->u.lov;
if (lsm == NULL) {
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
- int err = obd_cancel_unused(lov->tgts[i].ltd_exp, NULL,
- flags, opaque);
+ int err = obd_cancel_unused(lov->tgts[i].ltd_exp,
+ NULL, flags, opaque);
if (!rc)
rc = err;
}
RETURN (0);
}
+static int mdc_cancel_unused(struct obd_export *exp,
+ struct lov_stripe_md *lsm,
+ int flags, void *opaque)
+{
+ struct obd_device *obd = class_exp2obd(exp);
+
+ ENTRY;
+ RETURN(ldlm_cli_cancel_unused(obd->obd_namespace,
+ NULL, flags, opaque));
+}
+
int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
__u64 valid, const char *ea_name, int ea_namelen,
unsigned int ea_size, struct ptlrpc_request **request)
.o_set_info = mdc_set_info,
.o_get_info = mdc_get_info,
.o_brw = mdc_brw,
+ .o_cancel_unused = mdc_cancel_unused,
.o_init_ea_size = mdc_init_ea_size,
};
}
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;