From: OGAWA Hirofumi Date: Wed, 11 Mar 2009 17:03:23 +0000 (+0900) Subject: Fix _fat_bmap() locking X-Git-Tag: v2.6.29-rc8~28 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=3a95ea1155c5d44aa58dde2f64f0ddafe27fd1fb;p=~shefty%2Frdma-dev.git Fix _fat_bmap() locking On swapon() path, it has already i_mutex. So, this uses i_alloc_sem instead of it. Signed-off-by: OGAWA Hirofumi Reported-by: Laurent GUERBY Signed-off-by: Linus Torvalds --- diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 6b74d09adbe..de0004fe6e0 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -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; }