From: vitaly Date: Tue, 16 Jun 2009 12:34:43 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_9_220~141 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=c063c9d95e861847b24f2273f183602fc524ad80;p=fs%2Flustre-release.git Branch HEAD b=19154 i=rread i=tappro an ability to wait for the completion of an MDS-OST synchronization is added --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index e596a23..10da129 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -329,8 +329,9 @@ struct filter_obd { 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; diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index edf822b..fdc7248 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -446,7 +446,7 @@ int llog_cat_process_thread(void *data) 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; @@ -466,9 +466,10 @@ int llog_cat_process_thread(void *data) } 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"); } diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 5553323..21c24a7 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -2577,6 +2577,9 @@ static int filter_llog_connect(struct obd_export *exp, 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); diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index d1f4c18..61f84a3 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -252,6 +252,13 @@ int filter_recov_log_mds_ost_cb(struct llog_handle *llh, 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); diff --git a/lustre/obdfilter/lproc_obdfilter.c b/lustre/obdfilter/lproc_obdfilter.c index 7d4da23..bcc46ec 100644 --- a/lustre/obdfilter/lproc_obdfilter.c +++ b/lustre/obdfilter/lproc_obdfilter.c @@ -299,7 +299,9 @@ static int lprocfs_filter_wr_cache(struct file *file, const char *buffer, 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; } @@ -324,10 +326,21 @@ static int lprocfs_filter_wr_wcache(struct file *file, const char *buffer, 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 }, @@ -369,6 +382,7 @@ static struct lprocfs_vars lprocfs_filter_obd_vars[] = { { "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 } }; diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 74fe997..57c26b8 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -477,9 +477,21 @@ test_20b() { # bug 10480 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)) ] && \