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

Fix a boolean error when checking for no file locking.

lustre/llite/file.c
lustre/lov/lov_obd.c

index 5861307..c0a2429 100644 (file)
@@ -135,6 +135,7 @@ out_mdc:
 out_req:
         ptlrpc_free_req(req);
 //out_fd:
+        fd->fd_mdshandle.cookie = DEAD_HANDLE_MAGIC;
         kmem_cache_free(ll_file_data_slab, fd);
 out:
         return rc;
@@ -163,7 +164,7 @@ int ll_size_lock(struct inode *inode, struct lov_stripe_md *lsm, __u64 start,
                 RETURN(-ENOMEM);
 
         extent.start = start;
-        extent.end = OBD_PUNCH_EOF;
+        extent.end = OBD_OBJECT_EOF;
 
         rc = obd_enqueue(&sbi->ll_osc_conn, lsm, NULL, LDLM_EXTENT, &extent,
                          sizeof(extent), mode, &flags, ll_lock_callback,
@@ -324,8 +325,9 @@ out_mdc:
         EXIT;
 
 out_fd:
-        kmem_cache_free(ll_file_data_slab, fd);
+        fd->fd_mdshandle.cookie = DEAD_HANDLE_MAGIC;
         file->private_data = NULL;
+        kmem_cache_free(ll_file_data_slab, fd);
 out:
         return rc;
 }
@@ -410,8 +412,8 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count,
         ssize_t retval;
         ENTRY;
 
-        if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
-            sbi->ll_flags & LL_SBI_NOLCK) {
+        if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) &&
+            !(sbi->ll_flags & LL_SBI_NOLCK)) {
                 OBD_ALLOC(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
                 if (!lockhs)
                         RETURN(-ENOMEM);
@@ -439,8 +441,8 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count,
         if (retval > 0)
                 ll_update_atime(inode);
 
-        if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
-            sbi->ll_flags & LL_SBI_NOLCK) {
+        if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) &&
+            !(sbi->ll_flags & LL_SBI_NOLCK)) {
                 err = obd_cancel(&sbi->ll_osc_conn, lsm, LCK_PR, lockhs);
                 if (err != ELDLM_OK) {
                         CERROR("lock cancel: err: %d\n", err);
index d4e4633..0496edd 100644 (file)
@@ -567,8 +567,8 @@ static __u64 lov_offset(struct lov_stripe_md *lsm, __u64 lov_off, int stripeno)
         unsigned long swidth = ssize * lsm->lsm_stripe_count;
         unsigned long stripe_off;
 
-        if (lov_off == OBD_PUNCH_EOF)
-                return OBD_PUNCH_EOF;
+        if (lov_off == OBD_OBJECT_EOF)
+                return OBD_OBJECT_EOF;
 
         /* do_div(a, b) returns a % b, and a = a / b */
         stripe_off = do_div(lov_off, swidth);