Whamcloud - gitweb
Poisoning of all cookies at free time (to work around slab cache bug, and
authoradilger <adilger>
Fri, 11 Oct 2002 10:55:27 +0000 (10:55 +0000)
committeradilger <adilger>
Fri, 11 Oct 2002 10:55:27 +0000 (10:55 +0000)
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.

lustre/include/linux/lustre_idl.h
lustre/ldlm/ldlm_lock.c
lustre/llite/rw.c
lustre/mds/handler.c
lustre/obdclass/genops.c

index c97e8f7..94c991b 100644 (file)
@@ -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;
index ce8127a..069bd2a 100644 (file)
@@ -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);
index e78fb12..dff6bab 100644 (file)
@@ -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
index 3d40061..9685cc3 100644 (file)
@@ -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);
index 30e7574..6e923ee 100644 (file)
@@ -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;