int rc;
ENTRY;
+ if (osp->opd_storage->dd_rdonly)
+ RETURN(0);
+
/* Note: through f_oid is only 32 bits, it will also write 64 bits
* for oid to keep compatibility with the previous version. */
lb_oid->lb_buf = &fid->f_oid;
if (rc) {
CERROR("%s: init env error: rc = %d\n", d->opd_obd->obd_name,
rc);
+
+ spin_lock(&d->opd_pre_lock);
+ thread->t_flags = SVC_STOPPED;
+ spin_unlock(&d->opd_pre_lock);
+ wake_up(&thread->t_ctl_waitq);
+
RETURN(rc);
}
spin_lock_init(&d->opd_pre_lock);
init_waitqueue_head(&d->opd_pre_waitq);
init_waitqueue_head(&d->opd_pre_user_waitq);
+ thread_set_flags(&d->opd_pre_thread, SVC_INIT);
init_waitqueue_head(&d->opd_pre_thread.t_ctl_waitq);
/*
setup_timer(&d->opd_statfs_timer, osp_statfs_timer_cb,
(unsigned long)d);
+ if (d->opd_storage->dd_rdonly)
+ RETURN(0);
+
/*
* start thread handling precreation and statfs updates
*/
*/
void osp_precreate_fini(struct osp_device *d)
{
- struct ptlrpc_thread *thread;
-
+ struct ptlrpc_thread *thread = &d->opd_pre_thread;
ENTRY;
del_timer(&d->opd_statfs_timer);
if (d->opd_pre == NULL)
RETURN_EXIT;
- thread = &d->opd_pre_thread;
-
- thread->t_flags = SVC_STOPPING;
- wake_up(&d->opd_pre_waitq);
-
- wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED);
+ if (!thread_is_init(thread) && !thread_is_stopped(thread)) {
+ thread->t_flags = SVC_STOPPING;
+ wake_up(&d->opd_pre_waitq);
+ wait_event(thread->t_ctl_waitq, thread_is_stopped(thread));
+ }
OBD_FREE_PTR(d->opd_pre);
d->opd_pre = NULL;