]> git.karo-electronics.de Git - karo-tx-linux.git/commit
dm: dont take i_mutex to change device size
authorMike Snitzer <snitzer@redhat.com>
Thu, 13 Jan 2011 19:53:46 +0000 (19:53 +0000)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 26 Jun 2011 16:46:34 +0000 (12:46 -0400)
commit5202c9c68bbf0e57c5c302622ab8dbd9efa23305
tree5d010198f7faef4258c554c67e3eb6ae5620161d
parent693394c0404b8a4e34e4486797437779db0cac51
dm: dont take i_mutex to change device size

commit c217649bf2d60ac119afd71d938278cffd55962b upstream.

No longer needlessly hold md->bdev->bd_inode->i_mutex when changing the
size of a DM device.  This additional locking is unnecessary because
i_size_write() is already protected by the existing critical section in
dm_swap_table().  DM already has a reference on md->bdev so the
associated bd_inode may be changed without lifetime concerns.

A negative side-effect of having held md->bdev->bd_inode->i_mutex was
that a concurrent DM device resize and flush (via fsync) would deadlock.
Dropping md->bdev->bd_inode->i_mutex eliminates this potential for
deadlock.  The following reproducer no longer deadlocks:
  https://www.redhat.com/archives/dm-devel/2009-July/msg00284.html

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/md/dm.c