return NULL;
obj->obd = obd;
+ obj->state = 0;
obj->fid = *fid;
- obj->freeing = 0;
init_MUTEX(&obj->guard);
atomic_set(&obj->count, 0);
static void
__del_obj(struct lmv_obj *obj)
{
+ if (!(obj->state & O_FREEING))
+ LBUG();
+
list_del(&obj->list);
lmv_free_obj(obj);
}
/* check if object is in progress of destroying. If so - skip
* it. */
- if (obj->freeing)
+ if (obj->state & O_FREEING)
continue;
/* check if this is waht we're looking for. */
obj = __grab_obj(obd, fid);
if (obj) {
- obj->freeing = 1;
+ obj->state |= O_FREEING;
+
__put_obj(obj);
__put_obj(obj);
rc = 1;
if (obj->obd != obd)
continue;
+ obj->state |= O_FREEING;
__put_obj(obj);
}
spin_unlock(&lmv_obj_list_lock);