Whamcloud - gitweb
b=3119
authorzab <zab>
Tue, 4 May 2004 20:55:15 +0000 (20:55 +0000)
committerzab <zab>
Tue, 4 May 2004 20:55:15 +0000 (20:55 +0000)
Assert when page->private isn't what we expect.

lustre/ChangeLog
lustre/llite/llite_internal.h
lustre/llite/rw.c

index b2cf2ca..5c86853 100644 (file)
@@ -4,7 +4,7 @@ tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        - clear page cache after eviction (2766)
        - deal with strange write() on x86-64 (3043)
        - don't dereference NULL peer_ni in ldlm_handle_ast_error (3258)
-       - clear page->private before handing to FS (3119)
+       - clear page->private before handing to FS, better assertion (3119)
        - tune the read pipeline (3236)
        * miscellania
        - drop scimac NAL (unmaintained)
index 5031b20..5f8d86c 100644 (file)
@@ -155,6 +155,7 @@ void ll_removepage(struct page *page);
 int ll_readpage(struct file *file, struct page *page);
 struct ll_async_page *llap_from_cookie(void *cookie);
 struct ll_async_page *llap_from_page(struct page *page);
+struct ll_async_page *llap_cast_private(struct page *page);
 void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras);
 
 void ll_truncate(struct inode *inode);
index 18551bc..9236c54 100644 (file)
@@ -154,8 +154,8 @@ int ll_prepare_write(struct file *file, struct page *page, unsigned from,
         int rc = 0;
         ENTRY;
 
-        if (!PageLocked(page))
-                LBUG();
+        LASSERT(PageLocked(page));
+        (void)llap_cast_private(page); /* assertion */
 
         /* Check to see if we should return -EIO right away */
         pga.pg = page;
@@ -335,6 +335,17 @@ static struct obd_async_page_ops ll_async_page_ops = {
         .ap_completion =        ll_ap_completion,
 };
 
+struct ll_async_page *llap_cast_private(struct page *page)
+{
+        struct ll_async_page *llap = (struct ll_async_page *)page->private;
+
+        LASSERTF(llap == NULL || llap->llap_magic == LLAP_MAGIC,
+                 "page %p private %lu gave magic %d which != %d\n",
+                 page, page->private, llap->llap_magic, LLAP_MAGIC);
+
+        return llap;
+}
+
 /* XXX have the exp be an argument? */
 struct ll_async_page *llap_from_page(struct page *page)
 {
@@ -345,12 +356,9 @@ struct ll_async_page *llap_from_page(struct page *page)
         int rc;
         ENTRY;
 
-        llap = (struct ll_async_page *)page->private;
-        if (llap != NULL) {
-                if (llap->llap_magic != LLAP_MAGIC)
-                        RETURN(ERR_PTR(-EINVAL));
+        llap = llap_cast_private(page);
+        if (llap != NULL)
                 RETURN(llap);
-        }
 
         exp = ll_i2obdexp(page->mapping->host);
         if (exp == NULL)