diff options
author | Nick Piggin <npiggin@suse.de> | 2007-05-06 17:49:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:12:51 -0400 |
commit | 6fe6900e1e5b6fa9e5c59aa5061f244fe3f467e2 (patch) | |
tree | 8bbfe5072279227cc50a941ad4813908082426a1 /fs/ntfs/attrib.c | |
parent | 714b8171af9c930a59a0da8f6fe50518e70ab035 (diff) |
mm: make read_cache_page synchronous
Ensure pages are uptodate after returning from read_cache_page, which allows
us to cut out most of the filesystem-internal PageUptodate calls.
I didn't have a great look down the call chains, but this appears to fixes 7
possible use-before uptodate in hfs, 2 in hfsplus, 1 in jfs, a few in
ecryptfs, 1 in jffs2, and a possible cleared data overwritten with readpage in
block2mtd. All depending on whether the filler is async and/or can return
with a !uptodate page.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ntfs/attrib.c')
-rw-r--r-- | fs/ntfs/attrib.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index 7659cc192995..1c08fefe487a 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c | |||
@@ -2532,14 +2532,7 @@ int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt, const u8 val) | |||
2532 | page = read_mapping_page(mapping, idx, NULL); | 2532 | page = read_mapping_page(mapping, idx, NULL); |
2533 | if (IS_ERR(page)) { | 2533 | if (IS_ERR(page)) { |
2534 | ntfs_error(vol->sb, "Failed to read first partial " | 2534 | ntfs_error(vol->sb, "Failed to read first partial " |
2535 | "page (sync error, index 0x%lx).", idx); | 2535 | "page (error, index 0x%lx).", idx); |
2536 | return PTR_ERR(page); | ||
2537 | } | ||
2538 | wait_on_page_locked(page); | ||
2539 | if (unlikely(!PageUptodate(page))) { | ||
2540 | ntfs_error(vol->sb, "Failed to read first partial page " | ||
2541 | "(async error, index 0x%lx).", idx); | ||
2542 | page_cache_release(page); | ||
2543 | return PTR_ERR(page); | 2536 | return PTR_ERR(page); |
2544 | } | 2537 | } |
2545 | /* | 2538 | /* |
@@ -2602,14 +2595,7 @@ int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt, const u8 val) | |||
2602 | page = read_mapping_page(mapping, idx, NULL); | 2595 | page = read_mapping_page(mapping, idx, NULL); |
2603 | if (IS_ERR(page)) { | 2596 | if (IS_ERR(page)) { |
2604 | ntfs_error(vol->sb, "Failed to read last partial page " | 2597 | ntfs_error(vol->sb, "Failed to read last partial page " |
2605 | "(sync error, index 0x%lx).", idx); | 2598 | "(error, index 0x%lx).", idx); |
2606 | return PTR_ERR(page); | ||
2607 | } | ||
2608 | wait_on_page_locked(page); | ||
2609 | if (unlikely(!PageUptodate(page))) { | ||
2610 | ntfs_error(vol->sb, "Failed to read last partial page " | ||
2611 | "(async error, index 0x%lx).", idx); | ||
2612 | page_cache_release(page); | ||
2613 | return PTR_ERR(page); | 2599 | return PTR_ERR(page); |
2614 | } | 2600 | } |
2615 | kaddr = kmap_atomic(page, KM_USER0); | 2601 | kaddr = kmap_atomic(page, KM_USER0); |