From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4ACEC3A5AA for ; Wed, 4 Sep 2019 23:45:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA79D21881 for ; Wed, 4 Sep 2019 23:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567640719; bh=sLD7TWCuuTDypkRVtGgzbHmac5Y57V+ojUVVL0XIqu8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=K7apAcYX6fJKL2aVx3T20hSSa4w/pbdnKeIZuRxdtObnN0hdTVRvA5sf6XcYvkXLP 7Ll00px1pIJFWGu1wYQQ6uxcVuJrRxfqxeAWQNKUmwi9GC2bsxuD4232jWL6JPWqnR 47vszB0AE9+KpJTkodXzGAPMsqOvxzLgotAGqWpY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730541AbfIDXpS (ORCPT ); Wed, 4 Sep 2019 19:45:18 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:37471 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730496AbfIDXpS (ORCPT ); Wed, 4 Sep 2019 19:45:18 -0400 Received: by mail-lf1-f65.google.com with SMTP id w67so410642lff.4 for ; Wed, 04 Sep 2019 16:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lkW/YWLZKFkaRlur1cRxiMMOTA0gNhHwo+TbpZCC63g=; b=Cnu5WYs/aAthmsXfnwtWzL5CNjpaY23sMnhFtcX1zve3r2rc/Ho+dRzPF32HPRMBnj gveXLtTDU7YHSGctyOcfke7l1YNaudqputmw6AJ3ZcUOsNYmqHCIu9DY9WHGlywCQ4Su iCCcCFmwH9f6fkeMSqS83pY7B6dx4aSlHZljU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lkW/YWLZKFkaRlur1cRxiMMOTA0gNhHwo+TbpZCC63g=; b=gtDq8g/E6mKOaH1p0xau1V3z9bJevAzxI8D4gZplAEvfLZrsMBlwOtvZlhWFIj0PyG 4y/gsVJv19NmujwM/3/i2rFhKsb8YGOFAUnzaDU9ExmRAFH+QeGciX9notaa2UQdGtId uCvJ/fB0qrfSscLs2AguoenuYSaEhSBoigCwyhCXayaUuOgF5JfzhVWZdV9uTWgXY8SC 1/ZxC6OhY7Wkt5qvge9dmE5OZ7xi471x8DwwVII3OQZnLcffX8AJ9HUqCPDzbeaQVSC4 Ykrk40ePOXzyeWKejDZm0glgbwm2lHERefQhLLDTOIOpCzyI/8jPGS8N0NE0q9mSDbFd yq3g== X-Gm-Message-State: APjAAAV/k1ynEK8sgNJL5d99Npkjijk6lcE+eMAp4oS9yKMckn7Bd35q wCL9DPA0xJe94XJJ9d7Jv7lyQtrHtBA= X-Google-Smtp-Source: APXvYqyM8sV7uJtVwuKqOhMCQVVXj0v/lEtGgXA9Kf3rIZYS8LzFVpFuVUFKzM2MnidB7sR7UFkXqw== X-Received: by 2002:ac2:5ec1:: with SMTP id d1mr360193lfq.83.1567640715864; Wed, 04 Sep 2019 16:45:15 -0700 (PDT) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id t1sm44467lji.101.2019.09.04.16.45.12 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Sep 2019 16:45:14 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id a22so478761ljd.0 for ; Wed, 04 Sep 2019 16:45:12 -0700 (PDT) X-Received: by 2002:a2e:3a0e:: with SMTP id h14mr127121lja.180.1567640710863; Wed, 04 Sep 2019 16:45:10 -0700 (PDT) MIME-Version: 1.0 References: <20190904201933.10736-1-cyphar@cyphar.com> <20190904201933.10736-11-cyphar@cyphar.com> <20190904214856.vnvom7h5xontvngq@yavin.dot.cyphar.com> <20592.1567636276@warthog.procyon.org.uk> <20190904232911.GN1131@ZenIV.linux.org.uk> In-Reply-To: <20190904232911.GN1131@ZenIV.linux.org.uk> From: Linus Torvalds Date: Wed, 4 Sep 2019 16:44:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution To: Al Viro Cc: David Howells , Aleksa Sarai , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , Shuah Khan , Shuah Khan , Ingo Molnar , Peter Zijlstra , Christian Brauner , Jann Horn , Kees Cook , Eric Biederman , Andy Lutomirski , Andrew Morton , Alexei Starovoitov , Tycho Andersen , David Drysdale , Chanho Min , Oleg Nesterov , Rasmus Villemoes , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Aleksa Sarai , Linux Containers , alpha , Linux API , linux-arch , Linux ARM , linux-fsdevel , linux-ia64@vger.kernel.org, Linux List Kernel Mailing , "open list:KERNEL SELFTEST FRAMEWORK" , linux-m68k , linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390 , Linux-sh list , linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Sep 4, 2019 at 4:29 PM Al Viro wrote: > > On Wed, Sep 04, 2019 at 03:38:20PM -0700, Linus Torvalds wrote: > > On Wed, Sep 4, 2019 at 3:31 PM David Howells wrote: > > > > > > It ought to be reasonably easy to make them per-sb at least, I think. We > > > don't allow cross-super rename, right? > > > > Right now the sequence count handling very much depends on it being a > > global entity on the reader side, at least. > > > > And while the rename sequence count could (and probably should) be > > per-sb, the same is very much not true of the mount one. > > Huh? That will cost us having to have a per-superblock dentry > hash table; recall that lockless lockup can give false negatives > if something gets moved from chain to chain, and rename_lock is > first and foremost used to catch those and retry. If we split > it on per-superblock basis, we can't have dentries from different > superblocks in the same chain anymore... That's exactly the "very much depends on it being a global entity on the reader side" thing. I'm not convinced that's the _only_ way to handle things. Maybe a combination of (wild handwaving) per-hashqueue sequence count and some clever scheme for pathname handling could work. I've not personally seen a load where the global rename lock has been a problem (very few things really do a lot of renames), but system-wide locks do make me nervous. We have other (and worse) ones. tasklist_lock comes to mind. Linus