aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2012-02-20 17:52:46 -0500
committerTheodore Ts'o <tytso@mit.edu>2012-02-20 17:52:46 -0500
commit813e57276fd909f7d5a816ef7ca706fca491ee61 (patch)
treecc2d262c0f6524f1a18d2a168d03e2ae3eb624ab /fs/ext4/ext4.h
parent119c0d4460b001e44b41dcf73dc6ee794b98bd31 (diff)
ext4: fix race when setting bitmap_uptodate flag
In ext4_read_{inode,block}_bitmap() we were setting bitmap_uptodate() before submitting the buffer for read. The is bad, since we check bitmap_uptodate() without locking the buffer, and so if another process is racing with us, it's possible that they will think the bitmap is uptodate even though the read has not completed yet, resulting in inodes and blocks potentially getting allocated more than once if we get really unlucky. Addresses-Google-Bug: 2828254 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 513004fc3d84..315f01be73e6 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1794,8 +1794,14 @@ extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
1794 ext4_group_t block_group, 1794 ext4_group_t block_group,
1795 struct buffer_head ** bh); 1795 struct buffer_head ** bh);
1796extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); 1796extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
1797struct buffer_head *ext4_read_block_bitmap(struct super_block *sb, 1797
1798 ext4_group_t block_group); 1798extern struct buffer_head *ext4_read_block_bitmap_nowait(struct super_block *sb,
1799 ext4_group_t block_group);
1800extern int ext4_wait_block_bitmap(struct super_block *sb,
1801 ext4_group_t block_group,
1802 struct buffer_head *bh);
1803extern struct buffer_head *ext4_read_block_bitmap(struct super_block *sb,
1804 ext4_group_t block_group);
1799extern void ext4_init_block_bitmap(struct super_block *sb, 1805extern void ext4_init_block_bitmap(struct super_block *sb,
1800 struct buffer_head *bh, 1806 struct buffer_head *bh,
1801 ext4_group_t group, 1807 ext4_group_t group,
@@ -1841,6 +1847,7 @@ extern void ext4_check_inodes_bitmap(struct super_block *);
1841extern void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap); 1847extern void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
1842extern int ext4_init_inode_table(struct super_block *sb, 1848extern int ext4_init_inode_table(struct super_block *sb,
1843 ext4_group_t group, int barrier); 1849 ext4_group_t group, int barrier);
1850extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate);
1844 1851
1845/* mballoc.c */ 1852/* mballoc.c */
1846extern long ext4_mb_stats; 1853extern long ext4_mb_stats;