4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2012, Intel, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/osp/osp_sync.c
38 * Lustre OST Proxy Device
40 * Author: Alex Zhuravlev <alexey.zhuravlev@intel.com>
41 * Author: Mikhail Pershin <mike.pershin@intel.com>
45 # define EXPORT_SYMTAB
47 #define DEBUG_SUBSYSTEM S_MDS
49 #include "osp_internal.h"
52 * there are two specific states to take care about:
54 * = import is disconnected =
56 * = import is inactive =
57 * in this case osp_declare_object_create() returns an error
64 static inline int osp_statfs_need_update(struct osp_device *d)
66 return !cfs_time_before(cfs_time_current(),
67 d->opd_statfs_fresh_till);
70 static void osp_statfs_timer_cb(unsigned long _d)
72 struct osp_device *d = (struct osp_device *) _d;
75 cfs_waitq_signal(&d->opd_pre_waitq);
78 static int osp_statfs_interpret(const struct lu_env *env,
79 struct ptlrpc_request *req,
80 union ptlrpc_async_args *aa, int rc)
82 struct obd_import *imp = req->rq_import;
83 struct obd_statfs *msfs;
88 aa = ptlrpc_req_async_args(req);
89 d = aa->pointer_arg[0];
95 msfs = req_capsule_server_get(&req->rq_pill, &RMF_OBD_STATFS);
97 GOTO(out, rc = -EPROTO);
99 d->opd_statfs = *msfs;
101 osp_pre_update_status(d, rc);
103 /* schedule next update */
104 d->opd_statfs_fresh_till = cfs_time_shift(d->opd_statfs_maxage);
105 cfs_timer_arm(&d->opd_statfs_timer, d->opd_statfs_fresh_till);
106 d->opd_statfs_update_in_progress = 0;
108 CDEBUG(D_CACHE, "updated statfs %p\n", d);
112 /* couldn't update statfs, try again as soon as possible */
113 cfs_waitq_signal(&d->opd_pre_waitq);
114 if (req->rq_import_generation == imp->imp_generation)
115 CERROR("%s: couldn't update statfs: rc = %d\n",
116 d->opd_obd->obd_name, rc);
120 static int osp_statfs_update(struct osp_device *d)
122 struct ptlrpc_request *req;
123 struct obd_import *imp;
124 union ptlrpc_async_args *aa;
129 CDEBUG(D_CACHE, "going to update statfs\n");
131 imp = d->opd_obd->u.cli.cl_import;
134 req = ptlrpc_request_alloc(imp, &RQF_OST_STATFS);
138 rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_STATFS);
140 ptlrpc_request_free(req);
143 ptlrpc_request_set_replen(req);
144 req->rq_request_portal = OST_CREATE_PORTAL;
145 ptlrpc_at_set_req_timeout(req);
147 req->rq_interpret_reply = (ptlrpc_interpterer_t)osp_statfs_interpret;
148 aa = ptlrpc_req_async_args(req);
149 aa->pointer_arg[0] = d;
151 ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
153 cfs_timer_disarm(&d->opd_statfs_timer);
156 * no updates till reply
158 d->opd_statfs_fresh_till = cfs_time_shift(obd_timeout * 1000);
159 d->opd_statfs_update_in_progress = 1;
165 * XXX: there might be a case where removed object(s) do not add free
166 * space (empty object). if the number of such deletions is high, then
167 * we can start to update statfs too often - a rpc storm
168 * TODO: some throttling is needed
170 void osp_statfs_need_now(struct osp_device *d)
172 if (!d->opd_statfs_update_in_progress) {
174 * if current status is -ENOSPC (lack of free space on OST)
175 * then we should poll OST immediately once object destroy
178 d->opd_statfs_fresh_till = cfs_time_shift(-1);
179 cfs_timer_disarm(&d->opd_statfs_timer);
180 cfs_waitq_signal(&d->opd_pre_waitq);
186 * OSP tries to maintain pool of available objects so that calls to create
187 * objects don't block most of time
189 * each time OSP gets connected to OST, we should start from precreation cleanup
191 static inline int osp_precreate_running(struct osp_device *d)
193 return !!(d->opd_pre_thread.t_flags & SVC_RUNNING);
196 static inline int osp_precreate_stopped(struct osp_device *d)
198 return !!(d->opd_pre_thread.t_flags & SVC_STOPPED);
201 static inline int osp_precreate_near_empty_nolock(struct osp_device *d)
203 int window = d->opd_pre_last_created - d->opd_pre_next;
205 /* don't consider new precreation till OST is healty and
207 return ((window - d->opd_pre_reserved < d->opd_pre_grow_count / 2) &&
208 (d->opd_pre_status == 0));
211 static inline int osp_precreate_near_empty(struct osp_device *d)
215 /* XXX: do we really need locking here? */
216 cfs_spin_lock(&d->opd_pre_lock);
217 rc = osp_precreate_near_empty_nolock(d);
218 cfs_spin_unlock(&d->opd_pre_lock);
222 static int osp_precreate_send(struct osp_device *d)
224 struct ptlrpc_request *req;
225 struct obd_import *imp;
226 struct ost_body *body;
231 /* don't precreate new objects till OST healthy and has free space */
232 if (unlikely(d->opd_pre_status)) {
233 CDEBUG(D_INFO, "%s: don't send new precreate: rc = %d\n",
234 d->opd_obd->obd_name, d->opd_pre_status);
239 * if not connection/initialization is compeleted, ignore
241 imp = d->opd_obd->u.cli.cl_import;
244 req = ptlrpc_request_alloc(imp, &RQF_OST_CREATE);
247 req->rq_request_portal = OST_CREATE_PORTAL;
248 /* we should not resend create request - anyway we will have delorphan
249 * and kill these objects */
250 req->rq_no_delay = req->rq_no_resend = 1;
252 rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_CREATE);
254 ptlrpc_request_free(req);
258 cfs_spin_lock(&d->opd_pre_lock);
259 if (d->opd_pre_grow_count > d->opd_pre_max_grow_count / 2)
260 d->opd_pre_grow_count = d->opd_pre_max_grow_count / 2;
261 grow = d->opd_pre_grow_count;
262 cfs_spin_unlock(&d->opd_pre_lock);
264 body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
266 body->oa.o_id = d->opd_pre_last_created + grow;
267 body->oa.o_seq = FID_SEQ_OST_MDT0; /* XXX: support for CMD? */
268 body->oa.o_valid = OBD_MD_FLGROUP;
270 ptlrpc_request_set_replen(req);
272 rc = ptlrpc_queue_wait(req);
274 CERROR("%s: can't precreate: rc = %d\n",
275 d->opd_obd->obd_name, rc);
278 LASSERT(req->rq_transno == 0);
280 body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
282 GOTO(out_req, rc = -EPROTO);
284 CDEBUG(D_HA, "new last_created %lu\n", (unsigned long) body->oa.o_id);
285 LASSERT(body->oa.o_id > d->opd_pre_next);
287 diff = body->oa.o_id - d->opd_pre_last_created;
289 cfs_spin_lock(&d->opd_pre_lock);
291 /* the OST has not managed to create all the
292 * objects we asked for */
293 d->opd_pre_grow_count = max(diff, OST_MIN_PRECREATE);
294 d->opd_pre_grow_slow = 1;
296 /* the OST is able to keep up with the work,
297 * we could consider increasing grow_count
298 * next time if needed */
299 d->opd_pre_grow_slow = 0;
301 d->opd_pre_last_created = body->oa.o_id;
302 cfs_spin_unlock(&d->opd_pre_lock);
303 CDEBUG(D_OTHER, "current precreated pool: %llu-%llu\n",
304 d->opd_pre_next, d->opd_pre_last_created);
307 /* now we can wakeup all users awaiting for objects */
308 osp_pre_update_status(d, rc);
309 cfs_waitq_signal(&d->opd_pre_user_waitq);
311 ptlrpc_req_finished(req);
316 * asks OST to clean precreate orphans
317 * and gets next id for new objects
319 static int osp_precreate_cleanup_orphans(struct osp_device *d)
321 struct ptlrpc_request *req = NULL;
322 struct obd_import *imp;
323 struct ost_body *body;
328 LASSERT(d->opd_recovery_completed);
329 LASSERT(d->opd_pre_reserved == 0);
331 imp = d->opd_obd->u.cli.cl_import;
334 req = ptlrpc_request_alloc(imp, &RQF_OST_CREATE);
338 rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_CREATE);
340 ptlrpc_request_free(req);
344 body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
346 GOTO(out_req, rc = -EPROTO);
348 body->oa.o_flags = OBD_FL_DELORPHAN;
349 body->oa.o_valid = OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
350 body->oa.o_seq = FID_SEQ_OST_MDT0;
352 /* remove from NEXT after used one */
353 body->oa.o_id = d->opd_last_used_id + 1;
355 ptlrpc_request_set_replen(req);
357 /* Don't resend the delorphan req */
358 req->rq_no_resend = req->rq_no_delay = 1;
360 rc = ptlrpc_queue_wait(req);
362 ptlrpc_set_import_active(imp, 0);
366 body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
368 GOTO(out_req, rc = -EPROTO);
371 * OST provides us with id new pool starts from in body->oa.o_id
373 cfs_spin_lock(&d->opd_pre_lock);
374 if (le64_to_cpu(d->opd_last_used_id) > body->oa.o_id) {
375 d->opd_pre_grow_count = OST_MIN_PRECREATE +
376 le64_to_cpu(d->opd_last_used_id) -
378 d->opd_pre_last_created = le64_to_cpu(d->opd_last_used_id) + 1;
380 d->opd_pre_grow_count = OST_MIN_PRECREATE;
381 d->opd_pre_last_created = body->oa.o_id + 1;
383 d->opd_pre_next = d->opd_pre_last_created;
384 d->opd_pre_grow_slow = 0;
385 cfs_spin_unlock(&d->opd_pre_lock);
387 /* now we can wakeup all users awaiting for objects */
388 osp_pre_update_status(d, rc);
389 cfs_waitq_signal(&d->opd_pre_user_waitq);
391 CDEBUG(D_HA, "Got last_id "LPU64" from OST, last_used is "LPU64
392 ", next "LPU64"\n", body->oa.o_id,
393 le64_to_cpu(d->opd_last_used_id), d->opd_pre_next);
396 ptlrpc_req_finished(req);
401 * the function updates current precreation status used: functional or not
403 * rc is a last code from the transport, rc == 0 meaning transport works
404 * well and users of lod can use objects from this OSP
406 * the status depends on current usage of OST
408 void osp_pre_update_status(struct osp_device *d, int rc)
410 struct obd_statfs *msfs = &d->opd_statfs;
411 int old = d->opd_pre_status;
414 d->opd_pre_status = rc;
418 if (likely(msfs->os_type)) {
419 used = min_t(__u64, (msfs->os_blocks - msfs->os_bfree) >> 10,
421 if ((msfs->os_ffree < 32) || (msfs->os_bavail < used)) {
422 d->opd_pre_status = -ENOSPC;
424 CDEBUG(D_INFO, "%s: status: "LPU64" blocks, "
425 LPU64" free, "LPU64" used, "LPU64" "
426 "avail -> %d: rc = %d\n",
427 d->opd_obd->obd_name, msfs->os_blocks,
428 msfs->os_bfree, used, msfs->os_bavail,
429 d->opd_pre_status, rc);
431 "non-commited changes: %lu, in progress: %u\n",
432 d->opd_syn_changes, d->opd_syn_rpc_in_progress);
433 } else if (old == -ENOSPC) {
434 d->opd_pre_status = 0;
435 d->opd_pre_grow_slow = 0;
436 d->opd_pre_grow_count = OST_MIN_PRECREATE;
437 cfs_waitq_signal(&d->opd_pre_waitq);
438 CDEBUG(D_INFO, "%s: no space: "LPU64" blocks, "LPU64
439 " free, "LPU64" used, "LPU64" avail -> %d: "
440 "rc = %d\n", d->opd_obd->obd_name,
441 msfs->os_blocks, msfs->os_bfree, used,
442 msfs->os_bavail, d->opd_pre_status, rc);
447 cfs_waitq_signal(&d->opd_pre_user_waitq);
450 static int osp_precreate_thread(void *_arg)
452 struct osp_device *d = _arg;
453 struct ptlrpc_thread *thread = &d->opd_pre_thread;
454 struct l_wait_info lwi = { 0 };
460 sprintf(pname, "osp-pre-%u\n", d->opd_index);
461 cfs_daemonize(pname);
463 cfs_spin_lock(&d->opd_pre_lock);
464 thread->t_flags = SVC_RUNNING;
465 cfs_spin_unlock(&d->opd_pre_lock);
466 cfs_waitq_signal(&thread->t_ctl_waitq);
468 while (osp_precreate_running(d)) {
470 * need to be connected to OST
472 while (osp_precreate_running(d)) {
473 l_wait_event(d->opd_pre_waitq,
474 !osp_precreate_running(d) ||
475 d->opd_new_connection, &lwi);
477 if (!osp_precreate_running(d))
480 if (!d->opd_new_connection)
484 d->opd_new_connection = 0;
485 d->opd_got_disconnected = 0;
489 osp_statfs_update(d);
492 * wait for local recovery to finish, so we can cleanup orphans
493 * orphans are all objects since "last used" (assigned), but
494 * there might be objects reserved and in some cases they won't
495 * be used. we can't cleanup them till we're sure they won't be
496 * used. so we block new reservations and wait till all reserved
497 * objects either user or released.
499 l_wait_event(d->opd_pre_waitq, (!d->opd_pre_reserved &&
500 d->opd_recovery_completed) ||
501 !osp_precreate_running(d) ||
502 d->opd_got_disconnected, &lwi);
504 if (osp_precreate_running(d) && !d->opd_got_disconnected) {
505 rc = osp_precreate_cleanup_orphans(d);
507 CERROR("%s: cannot cleanup orphans: rc = %d\n",
508 d->opd_obd->obd_name, rc);
513 * connected, can handle precreates now
515 while (osp_precreate_running(d)) {
516 l_wait_event(d->opd_pre_waitq,
517 !osp_precreate_running(d) ||
518 osp_precreate_near_empty(d) ||
519 osp_statfs_need_update(d) ||
520 d->opd_got_disconnected, &lwi);
522 if (!osp_precreate_running(d))
525 /* something happened to the connection
526 * have to start from the beginning */
527 if (d->opd_got_disconnected)
530 if (osp_statfs_need_update(d))
531 osp_statfs_update(d);
533 if (osp_precreate_near_empty(d)) {
534 rc = osp_precreate_send(d);
535 /* osp_precreate_send() sets opd_pre_status
536 * in case of error, that prevent the using of
538 if (rc != 0 && rc != -ENOSPC &&
539 rc != -ETIMEDOUT && rc != -ENOTCONN)
540 CERROR("%s: cannot precreate objects:"
542 d->opd_obd->obd_name, rc);
547 thread->t_flags = SVC_STOPPED;
548 cfs_waitq_signal(&thread->t_ctl_waitq);
553 static int osp_precreate_ready_condition(struct osp_device *d)
555 /* ready if got enough precreated objects */
556 if (d->opd_pre_next + d->opd_pre_reserved < d->opd_pre_last_created)
559 /* ready if OST reported no space and no destoys in progress */
560 if (d->opd_syn_changes + d->opd_syn_rpc_in_progress == 0 &&
561 d->opd_pre_status != 0)
567 static int osp_precreate_timeout_condition(void *data)
569 struct osp_device *d = data;
571 LCONSOLE_WARN("%s: slow creates, last="LPU64", next="LPU64", "
572 "reserved="LPU64", syn_changes=%lu, "
573 "syn_rpc_in_progress=%d, status=%d\n",
574 d->opd_obd->obd_name, d->opd_pre_last_created,
575 d->opd_pre_next, d->opd_pre_reserved,
576 d->opd_syn_changes, d->opd_syn_rpc_in_progress,
583 * called to reserve object in the pool
585 * ENOSPC - no space on corresponded OST
586 * EAGAIN - precreation is in progress, try later
587 * EIO - no access to OST
589 int osp_precreate_reserve(const struct lu_env *env, struct osp_device *d)
591 struct l_wait_info lwi;
592 cfs_time_t expire = cfs_time_shift(obd_timeout);
597 LASSERT(d->opd_pre_last_created >= d->opd_pre_next);
599 lwi = LWI_TIMEOUT(cfs_time_seconds(obd_timeout),
600 osp_precreate_timeout_condition, d);
604 * - preallocation is done
605 * - no free space expected soon
606 * - can't connect to OST for too long (obd_timeout)
608 while ((rc = d->opd_pre_status) == 0 || rc == -ENOSPC ||
610 if (unlikely(rc == -ENODEV)) {
611 if (cfs_time_aftereq(cfs_time_current(), expire))
616 * increase number of precreations
618 if (d->opd_pre_grow_count < d->opd_pre_max_grow_count &&
619 d->opd_pre_grow_slow == 0 &&
620 (d->opd_pre_last_created - d->opd_pre_next <=
621 d->opd_pre_grow_count / 4 + 1)) {
622 cfs_spin_lock(&d->opd_pre_lock);
623 d->opd_pre_grow_slow = 1;
624 d->opd_pre_grow_count *= 2;
625 cfs_spin_unlock(&d->opd_pre_lock);
629 * we never use the last object in the window
631 cfs_spin_lock(&d->opd_pre_lock);
632 precreated = d->opd_pre_last_created - d->opd_pre_next;
633 if (precreated > d->opd_pre_reserved) {
634 d->opd_pre_reserved++;
635 cfs_spin_unlock(&d->opd_pre_lock);
638 /* XXX: don't wake up if precreation is in progress */
639 if (osp_precreate_near_empty_nolock(d))
640 cfs_waitq_signal(&d->opd_pre_waitq);
644 cfs_spin_unlock(&d->opd_pre_lock);
647 * all precreated objects have been used and no-space
648 * status leave us no chance to succeed very soon
649 * but if there is destroy in progress, then we should
650 * wait till that is done - some space might be released
652 if (unlikely(rc == -ENOSPC)) {
653 if (d->opd_syn_changes) {
654 /* force local commit to release space */
655 dt_commit_async(env, d->opd_storage);
657 if (d->opd_syn_rpc_in_progress) {
658 /* just wait till destroys are done */
659 /* see l_wait_even() few lines below */
661 if (d->opd_syn_changes +
662 d->opd_syn_rpc_in_progress == 0) {
663 /* no hope for free space */
668 /* XXX: don't wake up if precreation is in progress */
669 cfs_waitq_signal(&d->opd_pre_waitq);
671 l_wait_event(d->opd_pre_user_waitq,
672 osp_precreate_ready_condition(d), &lwi);
679 * this function relies on reservation made before
681 __u64 osp_precreate_get_id(struct osp_device *d)
685 /* grab next id from the pool */
686 cfs_spin_lock(&d->opd_pre_lock);
687 LASSERT(d->opd_pre_next <= d->opd_pre_last_created);
688 objid = d->opd_pre_next++;
689 d->opd_pre_reserved--;
691 * last_used_id must be changed along with getting new id otherwise
692 * we might miscalculate gap causing object loss or leak
694 osp_update_last_id(d, objid);
695 cfs_spin_unlock(&d->opd_pre_lock);
698 * probably main thread suspended orphan cleanup till
699 * all reservations are released, see comment in
700 * osp_precreate_thread() just before orphan cleanup
702 if (unlikely(d->opd_pre_reserved == 0 && d->opd_pre_status))
703 cfs_waitq_signal(&d->opd_pre_waitq);
711 int osp_object_truncate(const struct lu_env *env, struct dt_object *dt,
714 struct osp_device *d = lu2osp_dev(dt->do_lu.lo_dev);
715 struct ptlrpc_request *req = NULL;
716 struct obd_import *imp;
717 struct ost_body *body;
718 struct obdo *oa = NULL;
723 imp = d->opd_obd->u.cli.cl_import;
726 req = ptlrpc_request_alloc(imp, &RQF_OST_PUNCH);
730 /* XXX: capa support? */
731 /* osc_set_capa_size(req, &RMF_CAPA1, capa); */
732 rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_PUNCH);
734 ptlrpc_request_free(req);
739 * XXX: decide how do we do here with resend
740 * if we don't resend, then client may see wrong file size
741 * if we do resend, then MDS thread can get stuck for quite long
743 req->rq_no_resend = req->rq_no_delay = 1;
745 req->rq_request_portal = OST_IO_PORTAL; /* bug 7198 */
746 ptlrpc_at_set_req_timeout(req);
750 GOTO(out, rc = -ENOMEM);
752 rc = fid_ostid_pack(lu_object_fid(&dt->do_lu), &oa->o_oi);
755 oa->o_blocks = OBD_OBJECT_EOF;
756 oa->o_valid = OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
757 OBD_MD_FLID | OBD_MD_FLGROUP;
759 body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
761 lustre_set_wire_obdo(&body->oa, oa);
763 /* XXX: capa support? */
764 /* osc_pack_capa(req, body, capa); */
766 ptlrpc_request_set_replen(req);
768 rc = ptlrpc_queue_wait(req);
770 CERROR("can't punch object: %d\n", rc);
772 ptlrpc_req_finished(req);
778 int osp_init_precreate(struct osp_device *d)
780 struct l_wait_info lwi = { 0 };
785 /* initially precreation isn't ready */
786 d->opd_pre_status = -EAGAIN;
788 d->opd_pre_last_created = 1;
789 d->opd_pre_reserved = 0;
790 d->opd_got_disconnected = 1;
791 d->opd_pre_grow_slow = 0;
792 d->opd_pre_grow_count = OST_MIN_PRECREATE;
793 d->opd_pre_min_grow_count = OST_MIN_PRECREATE;
794 d->opd_pre_max_grow_count = OST_MAX_PRECREATE;
796 cfs_spin_lock_init(&d->opd_pre_lock);
797 cfs_waitq_init(&d->opd_pre_waitq);
798 cfs_waitq_init(&d->opd_pre_user_waitq);
799 cfs_waitq_init(&d->opd_pre_thread.t_ctl_waitq);
802 * Initialize statfs-related things
804 d->opd_statfs_maxage = 5; /* default update interval */
805 d->opd_statfs_fresh_till = cfs_time_shift(-1000);
806 CDEBUG(D_OTHER, "current %llu, fresh till %llu\n",
807 (unsigned long long)cfs_time_current(),
808 (unsigned long long)d->opd_statfs_fresh_till);
809 cfs_timer_init(&d->opd_statfs_timer, osp_statfs_timer_cb, d);
812 * start thread handling precreation and statfs updates
814 rc = cfs_create_thread(osp_precreate_thread, d, 0);
816 CERROR("can't start precreate thread %d\n", rc);
820 l_wait_event(d->opd_pre_thread.t_ctl_waitq,
821 osp_precreate_running(d) || osp_precreate_stopped(d),
827 void osp_precreate_fini(struct osp_device *d)
829 struct ptlrpc_thread *thread = &d->opd_pre_thread;
833 cfs_timer_disarm(&d->opd_statfs_timer);
835 thread->t_flags = SVC_STOPPING;
836 cfs_waitq_signal(&d->opd_pre_waitq);
838 cfs_wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED);