Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1912763imm; Fri, 6 Jul 2018 08:37:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcv7hcZAo2wT59mGtysWWxSHXmy7WnuTDf+s99Q7xrtBTxYYq9KxBRr4Dg9ckQgDyr8BTNG X-Received: by 2002:a63:5c52:: with SMTP id n18-v6mr9712097pgm.360.1530891423458; Fri, 06 Jul 2018 08:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530891423; cv=none; d=google.com; s=arc-20160816; b=m+nGUQivvJRR2zDehUj53KGZd054E4T66DvhPegJ2gyKhceoB45UX5+Vgd/oF09UAQ A8Hm1KrYk4ZGhz0Fd3qUag96Oi7N67fPfZFCDRDOc+zpBv1PR1CO8aLDSI9c3PRGTJM3 K/8VjA5tgD5nlBE1a2TLwwVlLiDYJq9HmQgBFZfPRT2PWI86Fd8YEkHhrbqRiIkn028T V5I4Q1Odxg47WVFZWo528c+0KxSZGhHGWrxoTy7LcLPulcfxNd6BMBNHC2uYPtDIZFBa KWcDyNNYdWALpUxWBAkWNQGZ2hekd3+eGDIgn33ggsplN0j5fqWUOQOeKPrUMXsSMCwD sd7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=JLffXw2ge01HDBy9zI+ZF9fw489JARQSa16hJXlbYv4=; b=S6EcNrYuFLoBHLjGl5NewYXL6je4ggOwV/+A5OnVbv7cNG5+gJarCr9UyumtCudK6S GKpezHm17koPwivH3hLJalHlCuOdMWzcfZxACRVD8luMc0NkJDqDJ2B+leul+Z31dlXN r3QRt0ex+08lt24gvbT6QO64b1/ZmjVPB/gp/mQRsK6YNwYcRG2GK8+NJ2MJF75S9OJZ DqxaSv0kgKagejQPzMBOGjtBGqnNFJyL1gWV77mcdtZFPVv1dWuR6VkMLvtvAAngYV3k YWSGP2RUMGMrGGLBnN3KrObaVirY4qbzMfdVUBBiELBeTkkTrwmn16brVM9FU5WHYCbP cDqw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5-v6si8138249plt.178.2018.07.06.08.36.39; Fri, 06 Jul 2018 08:37:03 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754097AbeGFPf5 (ORCPT + 99 others); Fri, 6 Jul 2018 11:35:57 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36388 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753915AbeGFPfz (ORCPT ); Fri, 6 Jul 2018 11:35:55 -0400 Received: by mail-wr1-f67.google.com with SMTP id h9-v6so4603027wro.3 for ; Fri, 06 Jul 2018 08:35:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=JLffXw2ge01HDBy9zI+ZF9fw489JARQSa16hJXlbYv4=; b=uZsMtc5tokGx8qDpT6Q41a2Gntwo4MOPpa8kPgrnRDlieq4sdewzlQR2itOxlksU8T 8BM39HUK4BdnB/7Fmiw6jo6xCLblmk1yP9Nuk5hgiwjH97VBFg2G7QiXhx+vpOt9913v pjAkmZ1EDcbi0a9Jz7lwSel82w2KZbC15nr4naTaZ5VuOL53hjx483pjwkTpRFHUVptW wx7Jdx3hsA9KZuGe/lUihsmim9Xezvry9WTf97l6qn6jOJbU6I/hzU9HC7qICeaRk8Pb WnRDGpPGEzilTGor5cDhcS7EktI5JiFSlfVpAWgiHBrwvycGW003XM+7guJYAG8oFCa7 9kuQ== X-Gm-Message-State: AOUpUlFz6pIS4LEJJkZBgNWjUB4kf9nSLGrqwsQ6yrsOVaoKguwSPTAS yCDhpIwmnCzTS0O/ic7dswXOHyf39+k= X-Received: by 2002:a5d:494c:: with SMTP id r12-v6mr313779wrs.66.1530891354485; Fri, 06 Jul 2018 08:35:54 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id 189-v6sm11700012wmd.17.2018.07.06.08.35.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Jul 2018 08:35:53 -0700 (PDT) From: Miklos Szeredi To: Al Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH (v4.18 regression fix)] vfs: don't evict uninitialized inode Date: Fri, 6 Jul 2018 17:35:48 +0200 Message-Id: <20180706153548.23287-1-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org iput() ends up calling ->evict() on new inode, which is not yet initialized by owning fs. So use destroy_inode() instead. Add to sb->s_inodes list only after the inode has been inserted into the hash. The exact point at which the inode is added onto the sb list shouldn't matter as long as it is done while the inode is in the I_NEW state. Reported-by: Al Viro Signed-off-by: Miklos Szeredi Fixes: 80ea09a002bf ("vfs: factor out inode_insert5()") --- fs/inode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 2c300e981796..2f6b411b904f 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1094,12 +1094,14 @@ struct inode *iget5_locked(struct super_block *sb, unsigned long hashval, struct inode *inode = ilookup5(sb, hashval, test, data); if (!inode) { - struct inode *new = new_inode(sb); + struct inode *new = new_inode_pseudo(sb); if (new) { inode = inode_insert5(new, hashval, test, set, data); if (unlikely(inode != new)) - iput(new); + destroy_inode(new); + else + inode_sb_list_add(inode); } } return inode; -- 2.14.3