Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751668Ab2K2Ghu (ORCPT ); Thu, 29 Nov 2012 01:37:50 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:44945 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751039Ab2K2Ght (ORCPT ); Thu, 29 Nov 2012 01:37:49 -0500 MIME-Version: 1.0 In-Reply-To: <20121129063043.GJ4939@ZenIV.linux.org.uk> References: <20121129062519.GI4939@ZenIV.linux.org.uk> <20121129063043.GJ4939@ZenIV.linux.org.uk> From: Linus Torvalds Date: Wed, 28 Nov 2012 22:37:27 -0800 X-Google-Sender-Auth: uScnX1nBuB6JdGPbbyt0lSgv_B8 Message-ID: Subject: Re: [PATCH] Introduce a method to catch mmap_region (was: Recent kernel "mount" slow) To: Al Viro Cc: Mikulas Patocka , 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: 1141 Lines: 25 On Wed, Nov 28, 2012 at 10:30 PM, Al Viro wrote: > > Note that sync_blockdev() a few lines prior to that is good only if we > have no other processes doing write(2) (or dirtying the mmapped pages, > for that matter). The window isn't too wide, but... So with Mikulas' patches, the write actually would block (at write level) due to the locking. The mmap'ed patches may be around and flushed, but the logic to not allow currently *active* mmaps (with the rather nasty random -EBUSY return value) should mean that there is no race. Or rather, there's a race, but it results in that EBUSY thing. With my simplfied locking, the sync_blockdev() is right before (not a few lines prior) to the kill_bdev(), and in a perfect world they'd actually be one single operation ("write back and invalidate pages with the wrong block-size"). But they aren't. Linus -- 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/