int fo_tot_granted_clients;
obd_size fo_readcache_max_filesize;
- int fo_read_cache;
- int fo_writethrough_cache;
+ int fo_read_cache:1, /**< enable read-only cache */
+ fo_writethrough_cache:1,/**< read cache writes */
+ fo_mds_ost_sync:1; /**< MDS-OST orphan recovery*/
struct obd_import *fo_mdc_imp;
struct obd_uuid fo_mdc_uuid;
struct llog_process_cat_args *args = data;
struct llog_ctxt *ctxt = args->lpca_ctxt;
struct llog_handle *llh = NULL;
- void *cb = args->lpca_cb;
+ llog_cb_t cb = args->lpca_cb;
struct llog_logid logid;
int rc;
ENTRY;
}
if (cb) {
- rc = llog_cat_process(llh, (llog_cb_t)cb, NULL, 0, 0);
+ rc = llog_cat_process(llh, cb, NULL, 0, 0);
if (rc != LLOG_PROC_BREAK && rc != 0)
CERROR("llog_cat_process() failed %d\n", rc);
+ cb(llh, NULL, NULL);
} else {
CWARN("No callback function for recovery\n");
}
obd->obd_name, body->lgdc_logid.lgl_oid,
body->lgdc_logid.lgl_ogr, body->lgdc_logid.lgl_ogen);
+ spin_lock_bh(&obd->obd_processing_task_lock);
+ obd->u.filter.fo_mds_ost_sync = 1;
+ spin_unlock_bh(&obd->obd_processing_task_lock);
rc = llog_connect(ctxt, &body->lgdc_logid,
&body->lgdc_gen, NULL);
llog_ctxt_put(ctxt);
if (ctxt->loc_obd->obd_stopping)
RETURN(LLOG_PROC_BREAK);
+ if (rec == NULL) {
+ spin_lock_bh(&ctxt->loc_obd->obd_processing_task_lock);
+ ctxt->loc_obd->u.filter.fo_mds_ost_sync = 0;
+ spin_unlock_bh(&ctxt->loc_obd->obd_processing_task_lock);
+ RETURN(0);
+ }
+
if (!(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN)) {
CERROR("log is not plain\n");
RETURN(-EINVAL);
if (rc)
return rc;
+ spin_lock_bh(&obd->obd_processing_task_lock);
obd->u.filter.fo_read_cache = val;
+ spin_unlock_bh(&obd->obd_processing_task_lock);
return count;
}
if (rc)
return rc;
+ spin_lock_bh(&obd->obd_processing_task_lock);
obd->u.filter.fo_writethrough_cache = val;
+ spin_unlock_bh(&obd->obd_processing_task_lock);
return count;
}
+static int lprocfs_filter_rd_mds_sync(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ LASSERT(obd != NULL);
+
+ return snprintf(page, count, "%u\n", obd->u.filter.fo_mds_ost_sync);
+}
+
static struct lprocfs_vars lprocfs_filter_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
{ "blocksize", lprocfs_rd_blksize, 0, 0 },
{ "read_cache_enable", lprocfs_filter_rd_cache, lprocfs_filter_wr_cache, 0},
{ "writethrough_cache_enable", lprocfs_filter_rd_wcache,
lprocfs_filter_wr_wcache, 0},
+ { "mds_sync", lprocfs_filter_rd_mds_sync, 0, 0},
{ 0 }
};
df -P $DIR || df -P $DIR || true # reconnect
wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
- # FIXME just because recovery is done doesn't mean we've finished
- # orphan cleanup. Fake it with a sleep for now...
- sleep 10
+ # just because recovery is done doesn't mean we've finished
+ # orphan cleanup. Wait for llogs to get synchronized.
+ echo waiting for orphan cleanup...
+ while [ true ]; do
+ local -a sync=($(do_facet ost "$LCTL get_param obdfilter.*.mds_sync" | awk -F= ' {print $2}'))
+ local con=1
+ for ((i=0; i<${#sync[@]}; i++)); do
+ [ ${sync[$i]} -eq 0 ] && continue
+ # there is a not finished MDS-OST synchronization
+ con=0
+ break;
+ done
+ [ ${con} -eq 1 ] && break
+ sleep 1
+ done
AFTERUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
log "before $BEFOREUSED, after $AFTERUSED"
[ $AFTERUSED -gt $((BEFOREUSED + 20)) ] && \