From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikulas Patocka Subject: [PATCH 0/4] Fix a crash when block device is read and block size is changed at the same time Date: Fri, 31 Aug 2012 14:40:26 -0400 (EDT) Message-ID: References: <20120628111541.GB17515@quack.suse.cz> <1343508252.2626.13184.camel@edumazet-glaptop> <1343556630.2626.13257.camel@edumazet-glaptop> <1343586962.2626.13266.camel@edumazet-glaptop> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Jens Axboe , Andrea Arcangeli , Jan Kara , dm-devel@redhat.com, linux-kernel@vger.kernel.org, Jeff Moyer , Alexander Viro , kosaki.motohiro@jp.fujitsu.com, linux-fsdevel@vger.kernel.org, lwoodman@redhat.com, "Alasdair G. Kergon" To: Eric Dumazet Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hi This is a series of patches to prevent a crash when when someone is reading block device and block size is changed simultaneously. (the crash is already happening in the production environment) The first patch adds a rw-lock to struct block_device, but doesn't use the lock anywhere. The reason why I submit this as a separate patch is that on my computer adding an unused field to this structure affects performance much more than any locking changes. The second patch uses the rw-lock. The lock is locked for read when doing I/O on the block device and it is locked for write when changing block size. The third patch converts the rw-lock to a percpu rw-lock for better performance, to avoid cache line bouncing. The fourth patch is an alternate percpu rw-lock implementation using RCU by Eric Dumazet. It avoids any atomic instruction in the hot path. Mikulas