diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2009-05-13 15:13:42 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-05-13 15:13:42 -0400 |
commit | 79ffab34391933ee3b95dac7f25c0478fa2f8f1e (patch) | |
tree | 8bc139928e172ef2ebd38e01f97dc01f886d8526 /fs/mpage.c | |
parent | 9fa7eb283c5cdc2b0f4a8cfe6387ed82e5e9a3d3 (diff) | |
download | lwn-79ffab34391933ee3b95dac7f25c0478fa2f8f1e.tar.gz lwn-79ffab34391933ee3b95dac7f25c0478fa2f8f1e.zip |
ext4: Properly initialize the buffer_head state
These struct buffer_heads are allocated on the stack (and hence are
initialized with stack garbage). They are only used to call a
get_blocks() function, so that's mostly OK, but b_state must be
initialized to be 0 so we don't have any unexpected BH_* flags set by
accident, such as BH_Unwritten or BH_Delay.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/mpage.c')
-rw-r--r-- | fs/mpage.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/mpage.c b/fs/mpage.c index 680ba60863ff..42381bd6543b 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -379,7 +379,8 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages, struct buffer_head map_bh; unsigned long first_logical_block = 0; - clear_buffer_mapped(&map_bh); + map_bh.b_state = 0; + map_bh.b_size = 0; for (page_idx = 0; page_idx < nr_pages; page_idx++) { struct page *page = list_entry(pages->prev, struct page, lru); @@ -412,7 +413,8 @@ int mpage_readpage(struct page *page, get_block_t get_block) struct buffer_head map_bh; unsigned long first_logical_block = 0; - clear_buffer_mapped(&map_bh); + map_bh.b_state = 0; + map_bh.b_size = 0; bio = do_mpage_readpage(bio, page, 1, &last_block_in_bio, &map_bh, &first_logical_block, get_block); if (bio) |