From 8e289e89e563a876ac86c39ae981dff5f9561d3a Mon Sep 17 00:00:00 2001 From: yury Date: Mon, 21 Jun 2004 12:16:29 +0000 Subject: [PATCH] obk->freeing changed to obj->state and O_FREEING flag is added instead. --- lustre/lmv/lmv_internal.h | 4 +++- lustre/lmv/lmv_objmgr.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index 35d4ab3..6bf7fa3 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -14,10 +14,12 @@ struct lmv_inode { int flags; }; +#define O_FREEING (1 << 0) + struct lmv_obj { struct list_head list; struct semaphore guard; - int freeing; /* object is freeing. */ + int state; /* object state. */ atomic_t count; struct ll_fid fid; /* master fid of dir */ void *update; /* bitmap of status (uptodate) */ diff --git a/lustre/lmv/lmv_objmgr.c b/lustre/lmv/lmv_objmgr.c index 50763dc..d00877d 100644 --- a/lustre/lmv/lmv_objmgr.c +++ b/lustre/lmv/lmv_objmgr.c @@ -66,8 +66,8 @@ lmv_alloc_obj(struct obd_device *obd, struct ll_fid *fid, return NULL; obj->obd = obd; + obj->state = 0; obj->fid = *fid; - obj->freeing = 0; init_MUTEX(&obj->guard); atomic_set(&obj->count, 0); @@ -130,6 +130,9 @@ lmv_add_obj(struct lmv_obj *obj) static void __del_obj(struct lmv_obj *obj) { + if (!(obj->state & O_FREEING)) + LBUG(); + list_del(&obj->list); lmv_free_obj(obj); } @@ -193,7 +196,7 @@ __grab_obj(struct obd_device *obd, struct ll_fid *fid) /* 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. */ @@ -337,7 +340,8 @@ lmv_delete_obj(struct obd_export *exp, struct ll_fid *fid) obj = __grab_obj(obd, fid); if (obj) { - obj->freeing = 1; + obj->state |= O_FREEING; + __put_obj(obj); __put_obj(obj); rc = 1; @@ -371,6 +375,7 @@ lmv_cleanup_mgr(struct obd_device *obd) if (obj->obd != obd) continue; + obj->state |= O_FREEING; __put_obj(obj); } spin_unlock(&lmv_obj_list_lock); -- 1.8.3.1