All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] deadlock when swapping to FAT
@ 2009-03-12 12:30 Mikulas Patocka
  2009-03-12 16:05 ` OGAWA Hirofumi
  0 siblings, 1 reply; 8+ messages in thread
From: Mikulas Patocka @ 2009-03-12 12:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: hirofumi

Hi

swapon will deadlock when an attempt to swap to a file on FAT filesystem 
is made. swapon holds i_mutex and FAT bmap is attempting to take it again.

This bug was introduced somewhere between 2.6.27 and 2.6.28.

No other filesystem is taking i_mutex in bmap, so I removed it as well.

Note that there are many other cases where bmap can race with truncate in 
almost all the filesystems. They don't impose an immediate threat because 
bmap can be only called by root. These problems should be solved in a 
generic way, not in individual filesystems.

Mikulas

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com
Cc: <stable@kernel.org>

---
 fs/fat/inode.c |    2 --
 1 file changed, 2 deletions(-)

Index: linux-2.6.29-rc7-devel/fs/fat/inode.c
===================================================================
--- linux-2.6.29-rc7-devel.orig/fs/fat/inode.c	2009-03-10 21:17:22.000000000 +0100
+++ linux-2.6.29-rc7-devel/fs/fat/inode.c	2009-03-11 22:52:38.000000000 +0100
@@ -202,9 +202,7 @@ static sector_t _fat_bmap(struct address
 	sector_t blocknr;
 
 	/* fat_get_cluster() assumes the requested blocknr isn't truncated. */
-	mutex_lock(&mapping->host->i_mutex);
 	blocknr = generic_block_bmap(mapping, block, fat_get_block);
-	mutex_unlock(&mapping->host->i_mutex);
 
 	return blocknr;
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-03-19 22:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-12 12:30 [PATCH] deadlock when swapping to FAT Mikulas Patocka
2009-03-12 16:05 ` OGAWA Hirofumi
2009-03-15  1:54   ` Mikulas Patocka
2009-03-15  3:22     ` OGAWA Hirofumi
2009-03-17 12:23       ` Mikulas Patocka
2009-03-17 16:08         ` OGAWA Hirofumi
2009-03-19 19:34           ` Mikulas Patocka
2009-03-19 22:27             ` OGAWA Hirofumi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.