Skip to content

Commit

Permalink
Fix _fat_bmap() locking
Browse files Browse the repository at this point in the history
On swapon() path, it has already i_mutex. So, this uses i_alloc_sem
instead of it.

Signed-off-by: OGAWA Hirofumi <[email protected]>
Reported-by: Laurent GUERBY <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
OGAWAHirofumi authored and torvalds committed Mar 11, 2009
1 parent ad3bdef commit 3a95ea1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/fat/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
sector_t blocknr;

/* fat_get_cluster() assumes the requested blocknr isn't truncated. */
mutex_lock(&mapping->host->i_mutex);
down_read(&mapping->host->i_alloc_sem);
blocknr = generic_block_bmap(mapping, block, fat_get_block);
mutex_unlock(&mapping->host->i_mutex);
up_read(&mapping->host->i_alloc_sem);

return blocknr;
}
Expand Down

0 comments on commit 3a95ea1

Please sign in to comment.