Received: by 10.223.185.116 with SMTP id b49csp731301wrg; Wed, 21 Feb 2018 06:05:49 -0800 (PST) X-Google-Smtp-Source: AH8x225GzGzI7YDhBZ5bai5H/xgYnwWbk5qOaaCoAMfvJ3OsI4pJvn6gAgWXobsZ1enXzJsuNg1O X-Received: by 10.101.70.65 with SMTP id k1mr2872812pgr.61.1519221949116; Wed, 21 Feb 2018 06:05:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519221949; cv=none; d=google.com; s=arc-20160816; b=F99qeu0a3czUaKpav0L5nvmCHgB9KVWDiZrnFzlVKeZZfWGSWr8lzr4fMkSCrw07+f kP0Rwdg5+dGeJj1GOlOiRKBEFhxRNjG0UX/x1+AfMWSAE89/uX/4OY1B11pYpSUU1Wd3 sHHBeLLSbvyUOdzW5mcM+Z2YEX6NwroyXIrwZeOYsVhLM2pwL/yPGRDkA6PsFORTT5aI MhtLAueaRIiaplw8YoBxBM/GDGMbx9mIRQ0BLyzR5y9q2OE5PNK50EmnOLsAPa35/nwh BSIEhvgt0nnd/HK+WNiGl7DypKHeWsPnqFYfVWyR8qTiz2WZgwrO0iQvhdnj9KNPO3Cg 0ldw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=nx+H9/MmP6lfQV6DMC8tZ5+eJLR6g7dJKscFMzz9eDo=; b=aUx7BoslhYVfdwofMQY2BqNKEJe+HJ+x2driD5kRSDscp0ec0Xi/zOvtjEKnX/Xbh9 pvYAEhc8wISZB2cs0E1Dj0bLVVZKYBuKPmtnX7misbqeaycipaoX4RXNdvoJ7RHp8RjN cUuHP2TyiX9fcDJssNW4PaH99KsM+8iS7R/iYkTLCZZBdo36qE8TNeqkr0nmIAQQ6ufC Nq5O4oAIYT5IPnMrSzoMIDynXpx6U7zDL0qPyt5wYw/xGtn+VK7ZlI2kKWMGlLkemoWu 6RwlJaCwB6PGehEdfM0a27qP8BPCpmncyUFZouWlRvBX9dbLg/yH4lXzsGioEAC6F6+R ErPw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si4863985pgc.282.2018.02.21.06.05.31; Wed, 21 Feb 2018 06:05:49 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935859AbeBUNEH (ORCPT + 99 others); Wed, 21 Feb 2018 08:04:07 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39758 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935831AbeBUNED (ORCPT ); Wed, 21 Feb 2018 08:04:03 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 330B1111C; Wed, 21 Feb 2018 13:04:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Bo , Nikolay Borisov , Josef Bacik , David Sterba Subject: [PATCH 4.14 137/167] Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly Date: Wed, 21 Feb 2018 13:49:08 +0100 Message-Id: <20180221124532.132874262@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Liu Bo commit e8f1bc1493855e32b7a2a019decc3c353d94daf6 upstream. This regression is introduced in commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction"). There are two problems, a) it is ->destroy_inode() that does the final free on inode, not ->evict_inode(), b) clear_inode() must be called before ->evict_inode() returns. This could end up hitting BUG_ON(inode->i_state != (I_FREEING | I_CLEAR)); in evict() because I_CLEAR is set in clear_inode(). Fixes: commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction") Cc: # v4.7-rc6+ Signed-off-by: Liu Bo Reviewed-by: Nikolay Borisov Reviewed-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5318,7 +5318,7 @@ void btrfs_evict_inode(struct inode *ino trace_btrfs_inode_evict(inode); if (!root) { - kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); + clear_inode(inode); return; }