Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932262Ab2K1TPg (ORCPT ); Wed, 28 Nov 2012 14:15:36 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:36876 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932195Ab2K1TPe (ORCPT ); Wed, 28 Nov 2012 14:15:34 -0500 MIME-Version: 1.0 In-Reply-To: References: <20121120180949.GG1408@quack.suse.cz> <50AF7901.20401@kernel.dk> <50B46E05.70906@kernel.dk> <50B4B313.3030707@kernel.dk> <50B5CC5A.8060607@kernel.dk> From: Linus Torvalds Date: Wed, 28 Nov 2012 11:15:12 -0800 X-Google-Sender-Auth: Ks1eyTRbCmHR884BbOBOck01y00 Message-ID: Subject: Re: [PATCH] Introduce a method to catch mmap_region (was: Recent kernel "mount" slow) To: Mikulas Patocka Cc: Jens Axboe , Jeff Chua , Lai Jiangshan , Jan Kara , lkml , linux-fsdevel Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1786 Lines: 43 No, this is crap. We don't introduce random hooks like this just because the block layer has shit-for-brains and cannot be bothered to do things right. The fact is, the whole locking in the block layer open routine is total and utter crap. It doesn't lock the right thing, even with your change *anyway* (or with the change Jens had). Absolutely nothing in "mmap_region()" cares at all about the block-size anywhere - it's generic, after all - so locking around it is f*cking pointless. There is no way in hell that the caller of ->mmap can *ever* care about the block size, since it never even looks at it. Don't do random crap like this. Why does the code think that mmap matters so much anyway? As you say, the mmap itself does *nothing*. It has no impact for the block size. Linus On Wed, Nov 28, 2012 at 9:25 AM, Mikulas Patocka wrote: > > > On Wed, 28 Nov 2012, Jens Axboe wrote: > >> On 2012-11-28 04:57, Mikulas Patocka wrote: >> > >> > This patch is wrong because you must check if the device is mapped while >> > holding bdev->bd_block_size_semaphore (because >> > bdev->bd_block_size_semaphore prevents new mappings from being created) >> >> No it doesn't. If you read the patch, that was moved to i_mmap_mutex. > > Hmm, it was wrong before the patch and it is wrong after the patch too. > > The problem is that ->mmap method doesn't do the actual mapping, the > caller of ->mmap (mmap_region) does it. So we must actually catch > mmap_region and protect it with the lock, not ->mmap. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/