diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-10-28 13:27:40 -0500 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-10-28 13:27:40 -0500 |
commit | 7038f1cbac899654cf0515e60dbe3e44d58271de (patch) | |
tree | 73909f95989f10bd85929073395e494ceb1a6b3f | |
parent | b6a47fd8ff08a9d5cd279cdb8d97a619983575fa (diff) | |
download | kernel_samsung_aries-7038f1cbac899654cf0515e60dbe3e44d58271de.zip kernel_samsung_aries-7038f1cbac899654cf0515e60dbe3e44d58271de.tar.gz kernel_samsung_aries-7038f1cbac899654cf0515e60dbe3e44d58271de.tar.bz2 |
JFS: make sure right-most xtree pages have header.next set to zero
The xtTruncate code was only doing this for leaf pages. When a file is
horribly fragmented, we may truncate a file leaving an internal page with
an invalid head.next field, which may cause a stale page to be referenced.
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
-rw-r--r-- | fs/jfs/jfs_xtree.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c index a7fe2f2..e72f4eb 100644 --- a/fs/jfs/jfs_xtree.c +++ b/fs/jfs/jfs_xtree.c @@ -3516,16 +3516,10 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) /* process entries backward from last index */ index = le16_to_cpu(p->header.nextindex) - 1; - if (p->header.flag & BT_INTERNAL) - goto getChild; - - /* - * leaf page - */ - /* Since this is the rightmost leaf, and we may have already freed - * a page that was formerly to the right, let's make sure that the - * next pointer is zero. + /* Since this is the rightmost page at this level, and we may have + * already freed a page that was formerly to the right, let's make + * sure that the next pointer is zero. */ if (p->header.next) { if (log) @@ -3539,6 +3533,12 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) p->header.next = 0; } + if (p->header.flag & BT_INTERNAL) + goto getChild; + + /* + * leaf page + */ freed = 0; /* does region covered by leaf page precede Teof ? */ |