NTFS: Fix read regression.
The regression was caused by:
commit[a32ea1e1f9
] Fix read/truncate race
This causes ntfs_readpage() to be called for a zero i_size inode, which
failed when the file was compressed and non-resident.
Thanks a lot to Mike Galbraith for reporting the issue and tracking down
the commit that caused the regression.
Looking into it I found three bugs which the patch fixes.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Tested-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
74521c28e5
commit
ebab89909e
@@ -561,6 +561,16 @@ int ntfs_read_compressed_block(struct page *page)
|
||||
read_unlock_irqrestore(&ni->size_lock, flags);
|
||||
max_page = ((i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) -
|
||||
offset;
|
||||
/* Is the page fully outside i_size? (truncate in progress) */
|
||||
if (xpage >= max_page) {
|
||||
kfree(bhs);
|
||||
kfree(pages);
|
||||
zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
|
||||
ntfs_debug("Compressed read outside i_size - truncated?");
|
||||
SetPageUptodate(page);
|
||||
unlock_page(page);
|
||||
return 0;
|
||||
}
|
||||
if (nr_pages < max_page)
|
||||
max_page = nr_pages;
|
||||
for (i = 0; i < max_page; i++, offset++) {
|
||||
|
Reference in New Issue
Block a user