struct cfg_marker {
__u32 cm_step; /* aka config version */
__u32 cm_flags;
- __u32 cm_timestamp;
+ time_t cm_createtime; /*when this record was first created */
+ time_t cm_canceltime; /*when this record is no longer valid*/
char cm_svname[16];
char cm_comment[40];
};
struct super_block *mgs_sb;
struct dentry *mgs_configs_dir;
struct dentry *mgs_fid_de;
- spinlock_t mgs_fs_db_lock;
+ spinlock_t mgs_fs_db_lock; /* add/remove db's */
struct list_head mgs_fs_db_list;
- struct semaphore mgs_log_sem;
+ struct semaphore mgs_log_sem; /* unused */
};
struct mds_obd {
/* FIXME sleep a few seconds here to allow the server who caused
the lock revocation to finish its setup */
- /* re-send server info every time, in case MGS needs to regen its
- logs */
+#if 0
+ /* Re-send server info every time, in case MGS needs to regen its
+ logs (for write_conf). Do we need this? It's extra RPCs for
+ every server at every update. */
server_register_target(cld->cld_cfg.cfg_sb);
+#endif
+
rc = mgc_process_log(the_mgc, cld);
+
class_export_put(the_mgc->obd_self_export);
-
RETURN(rc);
}
CERROR("original grant failed, won't requeue\n");
break;
}
-
if (!data) {
CERROR("missing data, won't requeue\n");
break;
}
- /* Reenque the lock in a separate thread, because we must
+ /* Re-enqueue the lock in a separate thread, because we must
return from this fn before that lock can be taken. */
rc = kernel_thread(mgc_async_requeue, data,
CLONE_VM | CLONE_FS);
RETURN(rc);
}
-/* based on ll_get_dir_page and osc_enqueue. */
+/* Take a config lock so we can get cancel notifications */
static int mgc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm,
__u32 type, ldlm_policy_data_t *policy, __u32 mode,
int *flags, void *bl_cb, void *cp_cb, void *gl_cb,
CDEBUG(D_MGC, "Enqueue for %s (res "LPX64")\n", cld->cld_logname,
cld->cld_resid.name[0]);
- /* Search for already existing locks.*/
- rc = ldlm_lock_match(obd->obd_namespace, 0, &cld->cld_resid, type,
- NULL, mode, lockh);
- if (rc == 1)
- RETURN(ELDLM_OK);
-
+ /* We need a callback for every lockholder, so don't try to
+ ldlm_lock_match (see rev 1.1.2.11.2.47) */
rc = ldlm_cli_enqueue(exp, NULL, obd->obd_namespace, cld->cld_resid,
type, NULL, mode, flags,
mgc_blocking_ast, ldlm_completion_ast, NULL,
data, NULL, 0, NULL, lockh);
- if (rc == 0) {
- /* Allow matches for other clients mounted on this host */
- struct ldlm_lock *lock = ldlm_handle2lock(lockh);
- LASSERT(lock);
- ldlm_lock_allow_match(lock);
- LDLM_LOCK_PUT(lock);
- }
RETURN(rc);
}
static int mgs_put_cfg_lock(struct lustre_handle *lockh)
{
- CERROR("mgs_unlock\n");
-
+ ENTRY;
ldlm_lock_decref(lockh, LCK_EX);
- return 0;
+ RETURN(0);
}
/* rc=0 means ok */
obd->obd_name, lockrc);
}
- /* There can be only 1 server adding at a time - don't want log
- writing contention. */
- /* Actually this should be okay because of the per-fs fsdb sem */
- //down(&obd->u.mgs.mgs_log_sem);
+ /* Log writing contention is handled by the fsdb_sem */
if (mti->mti_flags & LDD_F_WRITECONF) {
rc = mgs_erase_logs(obd, mti->mti_fsname);
}
out:
- //up(&obd->u.mgs.mgs_log_sem);
/* done with log update */
if (lockrc == ELDLM_OK)
mgs_put_cfg_lock(&lockh);
CDEBUG(D_MGS, "set param on fs %s device %s\n",
fsname, devname);
- //down(&obd->u.mgs.mgs_log_sem);
rc = mgs_setparam(obd, fsname, lcfg);
- //up(&obd->u.mgs.mgs_log_sem);
-
if (rc) {
CERROR("setparam err %d\n", rc);
GOTO(out_free, rc);
char *svname, char *comment)
{
struct cfg_marker marker;
+ struct timeval tv;
struct lustre_cfg_bufs bufs;
struct lustre_cfg *lcfg;
int rc;
- CDEBUG(D_MGS, "marker %#x %s\n", flags, comment);
-
if (flags & CM_START)
fsdb->fsdb_gen++;
marker.cm_step = fsdb->fsdb_gen;
marker.cm_flags = flags;
strncpy(marker.cm_svname, svname, sizeof(marker.cm_svname));
strncpy(marker.cm_comment, comment, sizeof(marker.cm_comment));
+ do_gettimeofday(&tv);
+ marker.cm_createtime = tv.tv_sec;
+ marker.cm_canceltime = 0;
lustre_cfg_bufs_reset(&bufs, NULL);
lustre_cfg_bufs_set(&bufs, 1, &marker, sizeof(marker));
lcfg = lustre_cfg_new(LCFG_MARKER, &bufs);
name_destroy(logname);
name_create(fsname, "-client", &logname);
name_create(fsname, "-clilov", &lovname);
- rc = mgs_write_log_direct(obd, fsdb, logname, lovname, lcfg);
+ /* Now, we still have to fix the devname (from the mdtlov
+ to the clilov) within the lcfg. We could copy the whole
+ lcfg... */
+ devname = lustre_cfg_string(lcfg, 0);
+ if (strlen(devname) == strlen(lovname)) {
+ strcpy(devname, lovname); /* ...or just hack it! */
+ rc = mgs_write_log_direct(obd, fsdb, logname,
+ lovname, lcfg);
+ }
name_destroy(lovname);
up(&fsdb->fsdb_sem);
}
}
/* BUSY just means that there's some other obd that
needs the mgc. Let him clean it up. */
- CDEBUG(D_MOUNT, "MGC busy, will stop later\n");
+ CDEBUG(D_MOUNT, "MGC still in use\n");
}
lustre_put_lsi(sb);
RETURN(rc);
}
case(LCFG_MARKER):{
struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1);
+
if (marker->cm_flags & CM_SKIP) {
if (marker->cm_flags & CM_START)
(*skip)++;
if (marker->cm_flags & CM_END)
(*skip)--;
}
- printf("marker %d (flags=%#x) %.16s '%s'", marker->cm_step,
- marker->cm_flags, marker->cm_svname, marker->cm_comment);
+ printf("marker %d (flags=%#x) %.16s '%s' %s:%s", marker->cm_step,
+ marker->cm_flags, marker->cm_svname,
+ marker->cm_comment, ctime(&marker->cm_createtime),
+ marker->cm_canceltime ?
+ ctime(&marker->cm_canceltime) : "");
break;
}
default: