return rc;
}
+static int mdt_hsm_pending_restore(struct mdt_thread_info *mti);
+static void cdt_start_pending_restore(struct mdt_device *mdt,
+ struct coordinator *cdt)
+{
+ struct mdt_thread_info *cdt_mti;
+ unsigned int i = 0;
+ int rc;
+
+ /* wait until MDD initialize hsm actions llog */
+ while (!test_bit(MDT_FL_CFGLOG, &mdt->mdt_state) && i < obd_timeout) {
+ schedule_timeout_interruptible(cfs_time_seconds(1));
+ i++;
+ }
+ if (!test_bit(MDT_FL_CFGLOG, &mdt->mdt_state))
+ CWARN("%s: trying to init HSM before MDD\n", mdt_obd_name(mdt));
+
+ /* set up list of started restore requests */
+ cdt_mti = lu_context_key_get(&cdt->cdt_env.le_ctx, &mdt_thread_key);
+ rc = mdt_hsm_pending_restore(cdt_mti);
+ if (rc)
+ CERROR("%s: cannot take the layout locks needed for registered restore: %d\n",
+ mdt_obd_name(mdt), rc);
+
+}
/**
* coordinator thread
/* Inform mdt_hsm_cdt_start(). */
wake_up(&cdt->cdt_waitq);
+ cdt_start_pending_restore(mdt, cdt);
while (1) {
int i;
{
struct coordinator *cdt = &mdt->mdt_coordinator;
struct mdt_thread_info *cdt_mti;
- unsigned int i = 0;
int rc;
void *ptr;
struct task_struct *task;
cdt->cdt_group_request_mask = (1UL << HSMA_RESTORE);
cdt->cdt_other_request_mask = (1UL << HSMA_RESTORE);
- /* wait until MDD initialize hsm actions llog */
- while (!test_bit(MDT_FL_CFGLOG, &mdt->mdt_state) && i < obd_timeout) {
- schedule_timeout_interruptible(cfs_time_seconds(1));
- i++;
- }
- if (!test_bit(MDT_FL_CFGLOG, &mdt->mdt_state))
- CWARN("%s: trying to init HSM before MDD\n", mdt_obd_name(mdt));
-
/* to avoid deadlock when start is made through sysfs
* sysfs entries are created by the coordinator thread
*/
- /* set up list of started restore requests */
- cdt_mti = lu_context_key_get(&cdt->cdt_env.le_ctx, &mdt_thread_key);
- rc = mdt_hsm_pending_restore(cdt_mti);
- if (rc)
- CERROR("%s: cannot take the layout locks needed"
- " for registered restore: %d\n",
- mdt_obd_name(mdt), rc);
-
if (mdt->mdt_bottom->dd_rdonly)
RETURN(0);
+ cdt_mti = lu_context_key_get(&cdt->cdt_env.le_ctx, &mdt_thread_key);
task = kthread_run(mdt_coordinator, cdt_mti, "hsm_cdtr");
if (IS_ERR(task)) {
rc = PTR_ERR(task);
}
run_test 131 "MDT backup restore with project ID"
+test_132() {
+ local err_cnt
+ local err_cnt2
+
+ reformat
+ combined_mgs_mds || start_mgs || error "unable to start MGS"
+ start_mdt 1 || error "unable to start mdt1"
+
+ err_cnt=$(do_facet mds1 dmesg | grep -c "cannot take the layout locks")
+ stop_mdt 1 || error "stop mdt1 failed"
+
+ [ "$mds1_FSTYPE" == zfs ] && import_zpool mds1
+ do_facet mds1 $TUNEFS --param mdt.hsm_control=enabled $(mdsdevname 1) ||
+ error "tunefs failed"
+ start_mdt 1 || error "cannot start mdt1"
+
+ err_cnt2=$(do_facet mds1 dmesg | grep -c "cannot take the layout locks")
+ [ $err_cnt -eq $err_cnt2 ] || error "Can not take the layout lock"
+ stop_mdt 1 || error "stop mdt1 failed"
+}
+run_test 132 "hsm_actions processed after failover"
+
if ! combined_mgs_mds ; then
stop mgs
fi