diff options
Diffstat (limited to 'fs/ntfs/aops.c')
-rw-r--r-- | fs/ntfs/aops.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index cfdc7900d271..ad87cb01299b 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
@@ -405,6 +405,15 @@ static int ntfs_readpage(struct file *file, struct page *page) | |||
405 | 405 | ||
406 | retry_readpage: | 406 | retry_readpage: |
407 | BUG_ON(!PageLocked(page)); | 407 | BUG_ON(!PageLocked(page)); |
408 | vi = page->mapping->host; | ||
409 | i_size = i_size_read(vi); | ||
410 | /* Is the page fully outside i_size? (truncate in progress) */ | ||
411 | if (unlikely(page->index >= (i_size + PAGE_CACHE_SIZE - 1) >> | ||
412 | PAGE_CACHE_SHIFT)) { | ||
413 | zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0); | ||
414 | ntfs_debug("Read outside i_size - truncated?"); | ||
415 | goto done; | ||
416 | } | ||
408 | /* | 417 | /* |
409 | * This can potentially happen because we clear PageUptodate() during | 418 | * This can potentially happen because we clear PageUptodate() during |
410 | * ntfs_writepage() of MstProtected() attributes. | 419 | * ntfs_writepage() of MstProtected() attributes. |
@@ -413,7 +422,6 @@ retry_readpage: | |||
413 | unlock_page(page); | 422 | unlock_page(page); |
414 | return 0; | 423 | return 0; |
415 | } | 424 | } |
416 | vi = page->mapping->host; | ||
417 | ni = NTFS_I(vi); | 425 | ni = NTFS_I(vi); |
418 | /* | 426 | /* |
419 | * Only $DATA attributes can be encrypted and only unnamed $DATA | 427 | * Only $DATA attributes can be encrypted and only unnamed $DATA |