From: zab Date: Tue, 4 May 2004 20:55:15 +0000 (+0000) Subject: b=3119 X-Git-Tag: v1_7_100~2317 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f4c9c39be9aba69eb5f6d78017e591813afa4d85;hp=60ad9f892674aaa8b58f5610f424e01fdf6f0b3f b=3119 Assert when page->private isn't what we expect. --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index b2cf2ca..5c86853 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -4,7 +4,7 @@ tbd Cluster File Systems, Inc. - 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) diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 5031b20..5f8d86c 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -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); diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 18551bc..9236c54 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -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)