diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2008-11-06 15:53:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-06 18:41:21 -0500 |
commit | 2bdf67eb1631f30e2f3f5d49e4007c76e88877a8 (patch) | |
tree | d3d337e52516b3b61cdf4508cf445ef8dcaae2ed /fs/fat/fat.h | |
parent | 0e75f5da06c05425f4b375eb981c4489fb2d9787 (diff) |
fat: mmu_private race fix
mmu_private is 64bits value, hence it's not atomic to update.
So, the access rule for mmu_private is we must hold ->i_mutex. But,
fat_get_block() path doesn't follow the rule on non-allocation path.
This fixes by using i_size instead if non-allocation path.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat/fat.h')
-rw-r--r-- | fs/fat/fat.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index a69f7f9757c0..4efc5038ed29 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -91,7 +91,9 @@ struct msdos_inode_info { | |||
91 | /* for avoiding the race between fat_free() and fat_get_cluster() */ | 91 | /* for avoiding the race between fat_free() and fat_get_cluster() */ |
92 | unsigned int cache_valid_id; | 92 | unsigned int cache_valid_id; |
93 | 93 | ||
94 | loff_t mmu_private; | 94 | /* NOTE: mmu_private is 64bits, so must hold ->i_mutex to access */ |
95 | loff_t mmu_private; /* physically allocated size */ | ||
96 | |||
95 | int i_start; /* first cluster or 0 */ | 97 | int i_start; /* first cluster or 0 */ |
96 | int i_logstart; /* logical first cluster */ | 98 | int i_logstart; /* logical first cluster */ |
97 | int i_attrs; /* unused attribute bits */ | 99 | int i_attrs; /* unused attribute bits */ |
@@ -222,7 +224,7 @@ extern void fat_cache_inval_inode(struct inode *inode); | |||
222 | extern int fat_get_cluster(struct inode *inode, int cluster, | 224 | extern int fat_get_cluster(struct inode *inode, int cluster, |
223 | int *fclus, int *dclus); | 225 | int *fclus, int *dclus); |
224 | extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys, | 226 | extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys, |
225 | unsigned long *mapped_blocks); | 227 | unsigned long *mapped_blocks, int create); |
226 | 228 | ||
227 | /* fat/dir.c */ | 229 | /* fat/dir.c */ |
228 | extern const struct file_operations fat_dir_operations; | 230 | extern const struct file_operations fat_dir_operations; |