Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a95ea11 authored by OGAWA Hirofumi's avatar OGAWA Hirofumi Committed by Linus Torvalds
Browse files

Fix _fat_bmap() locking



On swapon() path, it has already i_mutex. So, this uses i_alloc_sem
instead of it.

Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Reported-by: default avatarLaurent GUERBY <laurent@guerby.net>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ad3bdefe
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
}