fix block device size update serialization v2
- To: Jens Axboe <axboe@kernel.dk>
- Cc: Justin Sanders <justin@coraid.com>, Josef Bacik <josef@toxicpanda.com>, Xianting Tian <xianting_tian@126.com>, linux-block@vger.kernel.org, dm-devel@redhat.com, Stefan Haberland <sth@linux.ibm.com>, Jan Hoeppner <hoeppner@linux.ibm.com>, linux-kernel@vger.kernel.org, nbd@other.debian.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org
- Subject: fix block device size update serialization v2
- From: Christoph Hellwig <hch@lst.de>
- Date: Sun, 23 Aug 2020 11:10:40 +0200
- Message-id: <[🔎] 20200823091043.2600261-1-hch@lst.de>
Hi Jens,
this series fixes how we update i_size for the block device inodes (and
thus the block device). Different helpers use two different locks
(bd_mutex and i_rwsem) to protect the update, and it appears device
mapper uses yet another internal lock. A lot of the drivers do the
update handcrafted in often crufty ways. And in addition to that mess
it turns out that the "main" lock, bd_mutex is pretty dead lock prone
vs other spots in the block layer that acquire it during revalidation
operations, as reported by Xianting.
Fix all that by adding a dedicated spinlock just for the size updates.
Changes since v1:
- don't call __invalidate_device under the new spinlock
- don't call into the file system code from the nvme removal code
Reply to: