Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1863595ybt; Sun, 28 Jun 2020 00:05:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpbrf7DeADezwbxQMM3ZMnI9NlHA8JPoWzlxHSPkh0lS2m287dhfjZujeD94R0jinP4MiN X-Received: by 2002:a17:906:1682:: with SMTP id s2mr9849809ejd.532.1593327955611; Sun, 28 Jun 2020 00:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593327955; cv=none; d=google.com; s=arc-20160816; b=J2pUrONUmmuPlCJKxdD+4vuxi0WYq1Y/OkinIwYEzgvy9smpWO5MMPh8BOVvmCLiiW /gunjSwgTS1LTaseHyWF2+TIIZL0jS3m2g0SnjVVcamQleczgk5vxZ5nQVdK7aE40Rsq 9ywXeb28rAuCEZl8/LJ8Y8omMEQafFBfy+wIKhret1r+ShKj2FKzWkiznhwhmyLDoV4F t5D8rwx+HVCh+MaKTwKzOH+CQN4TKDcGl4Z4xIqWuRvQlfxW3nJ07dj1L7KEzw+LfbX8 zwPNpSo01I+NIAvRaeTBcZg6MUbLo3LrYsDb2IgjvlYbPQHfjxw+YJsMcA1b+BxXTwA9 SmAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gL7JS2Hbj/dvitd0obMk90veRliTtXToChY+G2xH0AE=; b=l/NYSoNjt2y9w7s7fFWabx0PP4K7NvH9pf8/dMur5wJrLqtfeNoQNJ2OEAaPN/dFMj CjZnis+1UT8YLIut5jzAQd2z7baKq1Myt/uQCdwz32QULRfIHgdYkGAqIYc/pawlp9n0 COPjXpVl9SIBoQms8uXKw1/d1kXXUcuC21UaZqi9/EerA3WI36VyHAsVxf23T1GshQf/ f6tkvKgTAVe2vf3MOEe1iSFXUXjU7njZLckaFJHZZU1eq5WA6dKFWPDL3gL+9uSvFX4c Xk4+3eGVZBGqSUJETs9oWv3LN3GiBek1SYUcae/gKrQbhXBfDAlsSfOqHobQ8C0VJ8k0 J+vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IYeU8A+T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb7si13699458ejb.316.2020.06.28.00.05.33; Sun, 28 Jun 2020 00:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IYeU8A+T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726105AbgF1HCv (ORCPT + 99 others); Sun, 28 Jun 2020 03:02:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:51956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgF1HCu (ORCPT ); Sun, 28 Jun 2020 03:02:50 -0400 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DCB0D20702; Sun, 28 Jun 2020 07:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593327770; bh=kfgopL0W3FtXqsVa/V5I6oQEZ9ZcW4URkZcEXEWUVKo=; h=From:To:Cc:Subject:Date:From; b=IYeU8A+Tvxs0WSfkv8jixPZMMpRMTIle7EdHOg6Tl5HgyFqfJAPx31xAACKxMxS2b OphWbGZwru9rEl9chZHBkKdd8Un94ahNMrfbRyr+nFMXcW/5wZ2PA7zERsy4UWjRQl qjoleNut6qzThofLcauuILWD4VHFr4jXiWlNTEEw= From: Eric Biggers To: linux-nilfs@vger.kernel.org, Ryusuke Konishi Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] nilfs2: only call unlock_new_inode() if I_NEW Date: Sun, 28 Jun 2020 00:01:52 -0700 Message-Id: <20200628070152.820311-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers unlock_new_inode() is only meant to be called after a new inode has already been inserted into the hash table. But nilfs_new_inode() can call it even before it has inserted the inode, triggering the WARNING in unlock_new_inode(). Fix this by only calling unlock_new_inode() if the inode has the I_NEW flag set, indicating that it's in the table. Signed-off-by: Eric Biggers --- fs/nilfs2/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 28009ec54420..3318dd1350b2 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -388,7 +388,8 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode) failed_after_creation: clear_nlink(inode); - unlock_new_inode(inode); + if (inode->i_state & I_NEW) + unlock_new_inode(inode); iput(inode); /* * raw_inode will be deleted through * nilfs_evict_inode(). -- 2.27.0