Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3943775imm; Mon, 11 Jun 2018 04:33:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKlH4PcjIEeCpb9/3jIYn9nNVXgfO1N4suwUlZJt8oZsIh5gpdH7yZjI15sAhi0u528TJ/n X-Received: by 2002:a62:8a83:: with SMTP id o3-v6mr17261252pfk.12.1528716795496; Mon, 11 Jun 2018 04:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528716795; cv=none; d=google.com; s=arc-20160816; b=JI+2eDWdkFMX4+XmeLkTciqqlK3zgE/SqruSUYTXznLqwpL7JIV/IBJourSGvr1Brv tjhrS8CC1mEih12yJz8pnAtQlrurYFV+54LE32CsPswqjDPnRx5C78R4bUaUSyadkTzx j0wyUfKuf1v7PaVW1tLP2J80YYPqYSbTMHlPKyh+Pcj0iPhyGpda3FMuEnXatj6G26ud Y8kkJBjiQ8f1hXG9b3EY++dazoAtmh12LaM6tr6h6nFrtOvbv+3FQEGDSsIqxZEzZhuP /BObKhjP2vbhW5ybiYxGgrTxT2VMQVqAbHQvSp82cG4fMxXUewGwJ3HqIthzkvFCYLXr DLbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=BvosY+glcajskazeW3QKx7oNpuMskaqjo8F6Czy62cY=; b=qi5CC7XP/wckLx1XMGZt6x0Ueh0NnLMInBwmr8bOCCx4BELwTvzfch4mMA9mRYtR9f zsBkQmteXr1kePJx3+SKXAYMRG8rgSGlc88fwWQx60/jYHz1DgWvnEniwrXZE1GTRkPC 43c77D86X1Ut4VGFMCA+fbxFiSGVoLIs1VQM+zkrGdLdxnStXCVNDtSXFODGsT2fFm+7 JYCFhZIO/2gT1gdKptUAmHQkwkoKYu231c0Frv6ylrFtK40dEqvoqLgouemK0Saqr6G7 9DEtFtOxPoujXddv30vnwNua8+3TgYbGhEHVTXVDWlVxP3wglblTOi1dLfYIdnqt5DGq qE4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Xgbmx+wH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21-v6si18731814pfd.78.2018.06.11.04.33.00; Mon, 11 Jun 2018 04:33:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Xgbmx+wH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932866AbeFKLcg (ORCPT + 99 others); Mon, 11 Jun 2018 07:32:36 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34957 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932765AbeFKLcf (ORCPT ); Mon, 11 Jun 2018 07:32:35 -0400 Received: by mail-wr0-f193.google.com with SMTP id l10-v6so20029711wrn.2 for ; Mon, 11 Jun 2018 04:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BvosY+glcajskazeW3QKx7oNpuMskaqjo8F6Czy62cY=; b=Xgbmx+wHheYnG/qHNvQydbn9aGXNWE8sSNqIZBp+1ecXIf7mM/1zmq8Bl7EbFTL9HY lEamNfLfF+A2nK1qX0KbZdFpwQw2XvyuQRSghDm2Tp/zaIWmfYH87SKu6F77lQ2Fvhct v4l7bd8BJDph2nGF3Cd0jsHNx7COieWzSko/o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BvosY+glcajskazeW3QKx7oNpuMskaqjo8F6Czy62cY=; b=XhYa0SzqBo5zE01C0lTEGHEeW5CwLXXB7lSgacePK2UOF78sOuXuGZ7k5c3GMyfsIV O8S8dImProX0XH1YkW6VUoU98TmOVqgo0qGOGSWufPaN+XLTijuA3nMwUg/lMGiMK4In c4o0pNxSj99AMG83OVSKg4fZRHsWzvAMY5Vdzo3iY0ggsEU0tbhylfk2OdxdiBQTIsNX NDpYs40Bmd5ylc0zhj9E7o4CQ8CuW7XhjQYG6m9UJXyccNgUK7GyYfLJadCWGn8bfapB AS5XPBhddAIxNeuZsfe9DGi0/jR7RBMSurYvpGuB0vLC8jXnU8C0E+U4PtOsQoOPMWKo /obg== X-Gm-Message-State: APt69E2OKmWxTBEeaXxT6GcSqtm8GsMG2lHuUzpRjXlohAaNL+y7PjTE nfke8H0B0fvMx/VGO8WfySNbsbCC X-Received: by 2002:adf:86ae:: with SMTP id 43-v6mr11580554wrx.281.1528716753810; Mon, 11 Jun 2018 04:32:33 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (C2B0E321.catv.pool.telekom.hu. [194.176.227.33]) by smtp.gmail.com with ESMTPSA id z5-v6sm23300034wrh.10.2018.06.11.04.32.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jun 2018 04:32:32 -0700 (PDT) Date: Mon, 11 Jun 2018 13:32:30 +0200 From: Miklos Szeredi To: Al Viro Cc: Miklos Szeredi , overlayfs , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/11] vfs: factor out inode_insert5() Message-ID: <20180611113230.GI23785@veci.piliscsaba.redhat.com> References: <20180529144143.16378-1-mszeredi@redhat.com> <20180529144143.16378-10-mszeredi@redhat.com> <20180610054902.GQ30522@ZenIV.linux.org.uk> <20180610060159.GS30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 11, 2018 at 11:15:55AM +0200, Miklos Szeredi wrote: > On Sun, Jun 10, 2018 at 8:02 AM, Al Viro wrote: > > On Sun, Jun 10, 2018 at 06:49:10AM +0100, Al Viro wrote: > >> On Tue, May 29, 2018 at 04:41:41PM +0200, Miklos Szeredi wrote: > >> > From: Miklos Szeredi > >> > > >> > Split out common helper for race free insertion of an already allocated > >> > inode into the cache. Use this from iget5_locked() and > >> > insert_inode_locked4(). Make iget5_locked() use new_inode()/iput() instead > >> > of alloc_inode()/destroy_inode() directly. > >> > >> ... thus hitting the sucker with ->evict_inode(), in condition that is quite > >> likely to be unfit to be seen by that. > >> > >> NAK. > > > > To clarify: objection here is against the switch to new_inode/iput. The rest is > > sane. What makes new_inode() better here, anyway? > > Umm, got to look into this. The patch has already been pulled by > Linus, but I hope it's salvageable. Incremental follows. I think it's cleaner to initialize i_state and i_sb_list up front (hence the use of new_inode()), but could just as well add to sb list afterwards. --- diff --git a/fs/inode.c b/fs/inode.c index 0df41bb77e0f..03c0d7c1296f 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1098,8 +1098,10 @@ struct inode *iget5_locked(struct super_block *sb, unsigned long hashval, if (new) { inode = inode_insert5(new, hashval, test, set, data); - if (unlikely(inode != new)) - iput(new); + if (unlikely(inode != new)) { + inode_sb_list_del(inode); + destroy_inode(new); + } } } return inode;