From: zab Date: Tue, 4 May 2004 21:16:56 +0000 (+0000) Subject: b=3119 X-Git-Tag: v1_8_0_110~486^5~218 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7da7bd940d4255349454a7b524de163339c34879;p=fs%2Flustre-release.git b=3119 Clear page->private while we're adding it to struct page. Make page->private errors really assertions as they're very bad and shouldn't happen. --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 20d312c..1ad8661 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -25,6 +25,7 @@ tbd Cluster File Systems, Inc. - fix ll_extent_lock() error return code for 64-bit systems (3043) - don't crash in mdc_close for bad permissions on open (3285) - zero i_rdev for non-device files (3147) + - clear page->private before handing to FS, better assertion (3119) * miscellania - allow default OST striping configuration per directory (1414) - increase maximum number of MDS request buffers for large systems diff --git a/lustre/kernel_patches/patches/add_page_private.patch b/lustre/kernel_patches/patches/add_page_private.patch index f82fb92..f7cc567 100644 --- a/lustre/kernel_patches/patches/add_page_private.patch +++ b/lustre/kernel_patches/patches/add_page_private.patch @@ -1,10 +1,8 @@ - include/linux/mm.h | 1 + - 1 files changed, 1 insertion(+) - ---- linux-2.4.20-b_llpio-l21/include/linux/mm.h~add_page_private 2003-07-21 21:42:50.000000000 -0700 -+++ linux-2.4.20-b_llpio-l21-zab/include/linux/mm.h 2003-07-21 21:44:16.000000000 -0700 -@@ -162,6 +162,7 @@ typedef struct page { - protected by pagemap_lru_lock !! */ +Index: linux-ia64/include/linux/mm.h +=================================================================== +--- linux-ia64.orig/include/linux/mm.h 2004-04-27 12:39:16.000000000 -0700 ++++ linux-ia64/include/linux/mm.h 2004-04-27 12:42:10.000000000 -0700 +@@ -205,6 +205,7 @@ typedef struct page { struct page **pprev_hash; /* Complement to *next_hash. */ struct buffer_head * buffers; /* Buffer maps us to a disk block. */ + unsigned long private; @@ -13,3 +11,13 @@ * On machines where all RAM is mapped into kernel address space, _ +Index: linux-ia64/mm/filemap.c +=================================================================== +--- linux-ia64.orig/mm/filemap.c 2004-04-27 12:35:18.000000000 -0700 ++++ linux-ia64/mm/filemap.c 2004-04-27 12:42:47.000000000 -0700 +@@ -676,6 +676,7 @@ static inline void __add_to_page_cache(s + page_cache_get(page); + page->index = offset; ++ page->private = 0; + add_page_to_inode_queue(mapping, page); + add_page_to_hash_queue(page, hash); diff --git a/lustre/kernel_patches/series/chaos-2.4.21 b/lustre/kernel_patches/series/chaos-2.4.21 index bdcae1e..0003912 100644 --- a/lustre/kernel_patches/series/chaos-2.4.21 +++ b/lustre/kernel_patches/series/chaos-2.4.21 @@ -22,7 +22,7 @@ jbd-dont-account-blocks-twice.patch jbd-commit-tricks.patch ext3-o_direct-2.4.21-chaos.patch ext3-no-write-super-chaos.patch -add_page_private.patch +add_page_private.patch ext3-raw-lookup.patch nfs_export_kernel-2.4.21-chaos.patch ext3-ea-in-inode-2.4.21-chaos.patch diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index a7a275c..fb678a3 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -151,6 +151,7 @@ int ll_sync_page(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 dec6617..d94ad24 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; @@ -336,6 +336,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) { @@ -346,12 +357,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)