public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: Drop inode if inode root is NULL
@ 2013-06-06  9:56 naota
  2013-06-06 10:13 ` Miao Xie
  0 siblings, 1 reply; 2+ messages in thread
From: naota @ 2013-06-06  9:56 UTC (permalink / raw)
  To: Chris Mason, linux-btrfs; +Cc: linux-kernel

There is a path where btrfs_drop_inode() is called with its inode's root
is NULL: In btrfs_new_inode(), when btrfs_set_inode_index() fails,
iput() is called. We should handle this case before taking look at the
root->root_item.

Signed-off-by: Naohiro Aota <naota@elisp.net>
---
 fs/btrfs/inode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index af978f7..17f3064 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8012,6 +8012,9 @@ int btrfs_drop_inode(struct inode *inode)
 {
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 
+	if (root == NULL)
+		return 1;
+
 	/* the snap/subvol tree is on deleting */
 	if (btrfs_root_refs(&root->root_item) == 0 &&
 	    root != root->fs_info->tree_root)
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-06 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-06  9:56 [PATCH] btrfs: Drop inode if inode root is NULL naota
2013-06-06 10:13 ` Miao Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox