From patchwork Wed Aug 17 18:56:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 1074802 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7HIuZar030130 for ; Wed, 17 Aug 2011 18:56:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751798Ab1HQS4b (ORCPT ); Wed, 17 Aug 2011 14:56:31 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:55145 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751045Ab1HQS4b (ORCPT ); Wed, 17 Aug 2011 14:56:31 -0400 Received: by fxh19 with SMTP id 19so833326fxh.19 for ; Wed, 17 Aug 2011 11:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:subject:to:from:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=EOOW1/HFf2OqvbmjCBfXs8gLNHgEj1PVgUaWvECWYJI=; b=iCR4nH0Ymv+x7kKC/PgHAIgtpQ/bjTtKhf3t7mIHsqRJ+xtOryO8HxQEEHsUSdUbaO Dr071dXHrqCr2RnM9cTjdSlPySDWDeugYUzU1eEq/uqVuQHRLm7SLdJIbaR0o8OzZQFG ryzRXDsnX0A9CKjjgyv/y6D25uFMomcqVQXaM= Received: by 10.223.1.83 with SMTP id 19mr1824719fae.74.1313607390027; Wed, 17 Aug 2011 11:56:30 -0700 (PDT) Received: from localhost (95-27-107-232.broadband.corbina.ru [95.27.107.232]) by mx.google.com with ESMTPS id 11sm1110611fav.34.2011.08.17.11.56.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Aug 2011 11:56:29 -0700 (PDT) Subject: [PATCH] btrfs: fix warning in iput for bad-inode To: linux-btrfs@vger.kernel.org, Chris Mason From: Konstantin Khlebnikov Date: Wed, 17 Aug 2011 22:56:19 +0400 Message-ID: <20110817185619.4660.78543.stgit@localhost6> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 17 Aug 2011 18:56:35 +0000 (UTC) iput() shouldn't be called for inodes in I_NEW state, lets call __destroy_inode() and btrfs_destroy_inode() instead [ 1.871723] WARNING: at fs/inode.c:1309 iput+0x1d9/0x200() [ 1.873722] Modules linked in: [ 1.873722] Pid: 1, comm: swapper Tainted: G W 3.1.0-rc2-zurg #58 [ 1.875722] Call Trace: [ 1.875722] [] ? iput+0x1d9/0x200 [ 1.876722] [] warn_slowpath_common+0x7a/0xb0 [ 1.877722] [] warn_slowpath_null+0x15/0x20 [ 1.879722] [] iput+0x1d9/0x200 [ 1.879722] [] btrfs_iget+0x1c4/0x450 [ 1.881721] [] ? btrfs_tree_read_unlock_blocking+0x3b/0x60 [ 1.882721] [] ? kmem_cache_free+0x2a/0x160 [ 1.883721] [] btrfs_lookup_dentry+0x413/0x490 [ 1.885721] [] ? get_parent_ip+0x11/0x50 [ 1.886720] [] btrfs_lookup+0x11/0x30 [ 1.887720] [] d_alloc_and_lookup+0x40/0x80 [ 1.888720] [] ? d_lookup+0x30/0x50 [ 1.889720] [] do_lookup+0x288/0x370 [ 1.890720] [] ? get_parent_ip+0x11/0x50 [ 1.891720] [] do_last+0xe0/0x910 [ 1.892720] [] path_openat+0xcd/0x3a0 [ 1.893719] [] ? wait_for_xmitr+0x3b/0xa0 [ 1.895719] [] ? put_dec_full+0x5a/0xb0 [ 1.896719] [] ? serial8250_console_putchar+0x2b/0x40 [ 1.897719] [] do_filp_open+0x3d/0xa0 [ 1.898719] [] ? get_parent_ip+0x11/0x50 [ 1.899718] [] ? get_parent_ip+0x11/0x50 [ 1.900718] [] ? sub_preempt_count+0x9d/0xd0 [ 1.902718] [] open_exec+0x2d/0xf0 [ 1.903718] [] do_execve_common.isra.32+0x12f/0x340 [ 1.906717] [] do_execve+0x16/0x20 [ 1.907717] [] sys_execve+0x42/0x70 [ 1.908717] [] kernel_execve+0x68/0xd0 [ 1.909717] [] ? run_init_process+0x1e/0x20 [ 1.911717] [] init_post+0x8e/0xc0 [ 1.912716] [] kernel_init+0x13d/0x13d [ 1.913716] [] kernel_thread_helper+0x4/0x10 [ 1.914716] [] ? start_kernel+0x33f/0x33f [ 1.915716] [] ? gs_change+0xb/0xb Signed-off-by: Konstantin Khlebnikov --- fs/btrfs/inode.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 15fceef..3e949bd 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3952,7 +3952,6 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, struct btrfs_root *root, int *new) { struct inode *inode; - int bad_inode = 0; inode = btrfs_iget_locked(s, location->objectid, root); if (!inode) @@ -3968,15 +3967,12 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, if (new) *new = 1; } else { - bad_inode = 1; + __destroy_inode(inode); + btrfs_destroy_inode(inode); + inode = ERR_PTR(-ESTALE); } } - if (bad_inode) { - iput(inode); - inode = ERR_PTR(-ESTALE); - } - return inode; }