aboutsummaryrefslogtreecommitdiff
path: root/fs/ufs
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2006-08-14 15:33:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-08-14 15:33:54 -0400
commite9ffb3d7ec94083a44a8721681391beca2ffd68c (patch)
tree6768ab487b3f44c2a4995ee61307e47760ca9b88 /fs/ufs
parent8b9411014e6f18a883c18b38f41338dbd53fddea (diff)
parente9fa4f7bd291c29a785666e2fa5a9cf3241ee6c3 (diff)
Merge branch 'from-linus' into upstream
Diffstat (limited to 'fs/ufs')
-rw-r--r--fs/ufs/balloc.c2
-rw-r--r--fs/ufs/util.c17
2 files changed, 10 insertions, 9 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index b01804baa12..b8238147577 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -248,7 +248,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk,
if (likely(cur_index != index)) {
page = ufs_get_locked_page(mapping, index);
- if (IS_ERR(page))
+ if (!page || IS_ERR(page)) /* it was truncated or EIO */
continue;
} else
page = locked_page;
diff --git a/fs/ufs/util.c b/fs/ufs/util.c
index 337cf2c46d1..22f820a9b15 100644
--- a/fs/ufs/util.c
+++ b/fs/ufs/util.c
@@ -251,12 +251,12 @@ struct page *ufs_get_locked_page(struct address_space *mapping,
{
struct page *page;
-try_again:
page = find_lock_page(mapping, index);
if (!page) {
page = read_cache_page(mapping, index,
(filler_t*)mapping->a_ops->readpage,
NULL);
+
if (IS_ERR(page)) {
printk(KERN_ERR "ufs_change_blocknr: "
"read_cache_page error: ino %lu, index: %lu\n",
@@ -266,6 +266,14 @@ try_again:
lock_page(page);
+ if (unlikely(page->mapping == NULL)) {
+ /* Truncate got there first */
+ unlock_page(page);
+ page_cache_release(page);
+ page = NULL;
+ goto out;
+ }
+
if (!PageUptodate(page) || PageError(page)) {
unlock_page(page);
page_cache_release(page);
@@ -275,15 +283,8 @@ try_again:
mapping->host->i_ino, index);
page = ERR_PTR(-EIO);
- goto out;
}
}
-
- if (unlikely(!page->mapping || !page_has_buffers(page))) {
- unlock_page(page);
- page_cache_release(page);
- goto try_again;/*we really need these buffers*/
- }
out:
return page;
}