From: OGAWA Hirofumi Fix a missing error check for sync_buffer_dirty(). Signed-off-by: OGAWA Hirofumi Signed-off-by: Andrew Morton --- 25-akpm/fs/fat/inode.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff -puN fs/fat/inode.c~fat-fix-fat_write_inode fs/fat/inode.c --- 25/fs/fat/inode.c~fat-fix-fat_write_inode Sun Mar 6 17:13:30 2005 +++ 25-akpm/fs/fat/inode.c Sun Mar 6 17:13:30 2005 @@ -463,18 +463,20 @@ static int fat_write_inode(struct inode struct buffer_head *bh; struct msdos_dir_entry *raw_entry; loff_t i_pos; + int err = 0; retry: i_pos = MSDOS_I(inode)->i_pos; - if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) { + if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) return 0; - } + lock_kernel(); - if (!(bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits))) { + bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits); + if (!bh) { printk(KERN_ERR "FAT: unable to read inode block " "for updating (i_pos %lld)\n", i_pos); - unlock_kernel(); - return -EIO; + err = -EIO; + goto out; } spin_lock(&sbi->inode_hash_lock); if (i_pos != MSDOS_I(inode)->i_pos) { @@ -502,11 +504,11 @@ retry: spin_unlock(&sbi->inode_hash_lock); mark_buffer_dirty(bh); if (wait) - sync_dirty_buffer(bh); + err = sync_dirty_buffer(bh); brelse(bh); +out: unlock_kernel(); - - return 0; + return err; } int fat_sync_inode(struct inode *inode) _