Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753954Ab2K2K5s (ORCPT ); Thu, 29 Nov 2012 05:57:48 -0500 Received: from mail-oa0-f46.google.com ([209.85.219.46]:58018 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753080Ab2K2K5p (ORCPT ); Thu, 29 Nov 2012 05:57:45 -0500 MIME-Version: 1.0 In-Reply-To: <20121129064539.GL4939@ZenIV.linux.org.uk> References: <20121129062519.GI4939@ZenIV.linux.org.uk> <20121129063043.GJ4939@ZenIV.linux.org.uk> <20121129064539.GL4939@ZenIV.linux.org.uk> Date: Thu, 29 Nov 2012 18:57:44 +0800 Message-ID: Subject: Re: [PATCH] Introduce a method to catch mmap_region (was: Recent kernel "mount" slow) From: Jeff Chua To: Al Viro Cc: Linus Torvalds , Mikulas Patocka , Jens Axboe , 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: 1583 Lines: 34 On Thu, Nov 29, 2012 at 2:45 PM, Al Viro wrote: > On Wed, Nov 28, 2012 at 10:37:27PM -0800, Linus Torvalds wrote: >> 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. > > Same as with fs mounted on it, or the sucker having been claimed for > RAID array, etc. Frankly, I'm more than slightly tempted to make > bdev mmap() just claim the sodding device exclusive for as long as > it's mmapped... > > In principle, I agree, but... I still have nightmares from mmap/truncate > races way back. You are stepping into what used to be a really nasty > minefield. I'll look into that, but it's *definitely* not -rc8 fodder. Just let me know which relevant patch(es) you want me to test or break. Thanks, Jeff -- 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/