提交 5e35dd46 编写于 作者: O OGAWA Hirofumi 提交者: Linus Torvalds

fat: Fix fat_ent_update_ptr() for FAT12

This fixes the missing update for bhs/nr_bhs in case the caller
accessed from block boundary to first block of boundary.
Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 d3dfa822
...@@ -317,10 +317,20 @@ static inline int fat_ent_update_ptr(struct super_block *sb, ...@@ -317,10 +317,20 @@ static inline int fat_ent_update_ptr(struct super_block *sb,
/* Is this fatent's blocks including this entry? */ /* Is this fatent's blocks including this entry? */
if (!fatent->nr_bhs || bhs[0]->b_blocknr != blocknr) if (!fatent->nr_bhs || bhs[0]->b_blocknr != blocknr)
return 0; return 0;
/* Does this entry need the next block? */ if (sbi->fat_bits == 12) {
if (sbi->fat_bits == 12 && (offset + 1) >= sb->s_blocksize) { if ((offset + 1) < sb->s_blocksize) {
if (fatent->nr_bhs != 2 || bhs[1]->b_blocknr != (blocknr + 1)) /* This entry is on bhs[0]. */
return 0; if (fatent->nr_bhs == 2) {
brelse(bhs[1]);
fatent->nr_bhs = 1;
}
} else {
/* This entry needs the next block. */
if (fatent->nr_bhs != 2)
return 0;
if (bhs[1]->b_blocknr != (blocknr + 1))
return 0;
}
} }
ops->ent_set_ptr(fatent, offset); ops->ent_set_ptr(fatent, offset);
return 1; return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册