diff options
Diffstat (limited to 'fs/ufs/util.c')
-rw-r--r-- | fs/ufs/util.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/ufs/util.c b/fs/ufs/util.c index 337cf2c46d10..22f820a9b15c 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, | |||
251 | { | 251 | { |
252 | struct page *page; | 252 | struct page *page; |
253 | 253 | ||
254 | try_again: | ||
255 | page = find_lock_page(mapping, index); | 254 | page = find_lock_page(mapping, index); |
256 | if (!page) { | 255 | if (!page) { |
257 | page = read_cache_page(mapping, index, | 256 | page = read_cache_page(mapping, index, |
258 | (filler_t*)mapping->a_ops->readpage, | 257 | (filler_t*)mapping->a_ops->readpage, |
259 | NULL); | 258 | NULL); |
259 | |||
260 | if (IS_ERR(page)) { | 260 | if (IS_ERR(page)) { |
261 | printk(KERN_ERR "ufs_change_blocknr: " | 261 | printk(KERN_ERR "ufs_change_blocknr: " |
262 | "read_cache_page error: ino %lu, index: %lu\n", | 262 | "read_cache_page error: ino %lu, index: %lu\n", |
@@ -266,6 +266,14 @@ try_again: | |||
266 | 266 | ||
267 | lock_page(page); | 267 | lock_page(page); |
268 | 268 | ||
269 | if (unlikely(page->mapping == NULL)) { | ||
270 | /* Truncate got there first */ | ||
271 | unlock_page(page); | ||
272 | page_cache_release(page); | ||
273 | page = NULL; | ||
274 | goto out; | ||
275 | } | ||
276 | |||
269 | if (!PageUptodate(page) || PageError(page)) { | 277 | if (!PageUptodate(page) || PageError(page)) { |
270 | unlock_page(page); | 278 | unlock_page(page); |
271 | page_cache_release(page); | 279 | page_cache_release(page); |
@@ -275,15 +283,8 @@ try_again: | |||
275 | mapping->host->i_ino, index); | 283 | mapping->host->i_ino, index); |
276 | 284 | ||
277 | page = ERR_PTR(-EIO); | 285 | page = ERR_PTR(-EIO); |
278 | goto out; | ||
279 | } | 286 | } |
280 | } | 287 | } |
281 | |||
282 | if (unlikely(!page->mapping || !page_has_buffers(page))) { | ||
283 | unlock_page(page); | ||
284 | page_cache_release(page); | ||
285 | goto try_again;/*we really need these buffers*/ | ||
286 | } | ||
287 | out: | 288 | out: |
288 | return page; | 289 | return page; |
289 | } | 290 | } |