From: adilger Date: Fri, 11 Oct 2002 10:55:27 +0000 (+0000) Subject: Poisoning of all cookies at free time (to work around slab cache bug, and X-Git-Tag: 0.5.14~9 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5e35b6532f48a9cf4ed5121af8a1a182e678f2cd;p=fs%2Flustre-release.git Poisoning of all cookies at free time (to work around slab cache bug, and also potential problems when we don't have CONFIG_DEBUG_SLAB enabled. Rename OBD_PUNCH_EOF as OBD_OBJECT_EOF, since we use it in places other than punch. --- diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index c97e8f7..94c991b 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -97,6 +97,7 @@ struct lustre_handle { __u64 addr; __u64 cookie; }; +#define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabe static inline void ptlrpc_invalidate_handle(struct lustre_handle *hdl) { @@ -246,7 +247,7 @@ struct obd_statfs { #define OBD_BRW_RWMASK (OBD_BRW_READ | OBD_BRW_WRITE) #define OBD_BRW_CREATE 0x4 -#define OBD_PUNCH_EOF 0xffffffffffffffffULL +#define OBD_OBJECT_EOF 0xffffffffffffffffULL struct obd_ioobj { obd_id ioo_id; diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index ce8127a..069bd2a 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -165,7 +165,7 @@ void ldlm_lock_put(struct ldlm_lock *lock) spin_unlock(&ns->ns_counter_lock); lock->l_resource = NULL; - lock->l_random = 0xdeadbeefcafebabe; + lock->l_random = DEAD_HANDLE_MAGIC; if (lock->l_export && lock->l_export->exp_connection) ptlrpc_put_connection(lock->l_export->exp_connection); kmem_cache_free(ldlm_lock_slab, lock); diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index e78fb12..dff6bab 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -74,7 +74,7 @@ inline void set_page_clean(struct page *page) static int ll_brw(int cmd, struct inode *inode, struct page *page, int create) { struct ll_inode_info *lli = ll_i2info(inode); - struct lov_stripe_md *md = lli->lli_smd; + struct lov_stripe_md *lsm = lli->lli_smd; struct io_cb_data *cbd = ll_init_cb(); struct brw_page pg; int err; @@ -90,7 +90,7 @@ static int ll_brw(int cmd, struct inode *inode, struct page *page, int create) pg.off = ((obd_off)page->index) << PAGE_SHIFT; pg.flag = create ? OBD_BRW_CREATE : 0; - err = obd_brw(cmd, ll_i2obdconn(inode), md, 1, &pg, ll_sync_io_cb, cbd); + err = obd_brw(cmd, ll_i2obdconn(inode),lsm, 1, &pg, ll_sync_io_cb, cbd); RETURN(err); } /* ll_brw */ @@ -260,10 +260,9 @@ void ll_truncate(struct inode *inode) LBUG(); } - /* truncate == punch to/from start from/to end: - set end to -1 for that. */ + /* truncate == punch from new size to absolute end of file */ err = obd_punch(ll_i2obdconn(inode), &oa, lsm, inode->i_size, - OBD_PUNCH_EOF); + OBD_OBJECT_EOF); if (err) CERROR("obd_truncate fails (%d)\n", err); else diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 3d40061..9685cc3 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -819,6 +819,7 @@ out_pack: RETURN(0); out_free: + mfd->mfd_serverookie = DEAD_HANDLE_MAGIC; kmem_cache_free(mds_file_cache, mfd); req->rq_status = rc; RETURN(0); @@ -849,6 +850,7 @@ static int mds_close(struct ptlrpc_request *req) spin_lock(&med->med_open_lock); list_del(&mfd->mfd_list); spin_unlock(&med->med_open_lock); + mfd->mfd_serverookie = DEAD_HANDLE_MAGIC; kmem_cache_free(mds_file_cache, mfd); req->rq_status = filp_close(file, 0); diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 30e7574..6e923ee 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -395,6 +395,7 @@ void class_destroy_export(struct obd_export *exp) //ptlrpc_put_connection(exp->exp_connection); } + exp->exp_cookie = DEAD_HANDLE_MAGIC; kmem_cache_free(export_cachep, exp); EXIT;