From 8f443e2372ba23d51ee365974f54507acd6f69d1 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 21 Apr 2015 09:17:28 -0700 Subject: Revert "ocfs2: incorrect check for debugfs returns" This reverts commit e2ac55b6a8e337fac7cc59c6f452caac92ab5ee6. Huang Ying reports that this causes a hang at boot with debugfs disabled. It is true that the debugfs error checks are kind of confusing, and this code certainly merits more cleanup and thinking about it, but there's something wrong with the trivial "check not just for NULL, but for error pointers too" patch. Yes, with debugfs disabled, we will end up setting the o2hb_debug_dir pointer variable to an error pointer (-ENODEV), and then continue as if everything was fine. But since debugfs is disabled, all the _users_ of that pointer end up being compiled away, so even though the pointer can not be dereferenced, that's still fine. So it's confusing and somewhat questionable, but the "more correct" error checks end up causing more trouble than they fix. Reported-by: Huang Ying Acked-by: Andrew Morton Acked-by: Chengyu Song Signed-off-by: Linus Torvalds --- fs/ocfs2/super.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'fs/ocfs2/super.c') diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 837ddce4b659..403c5660b306 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1112,7 +1112,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) osb->osb_debug_root = debugfs_create_dir(osb->uuid_str, ocfs2_debugfs_root); - if (IS_ERR_OR_NULL(osb->osb_debug_root)) { + if (!osb->osb_debug_root) { status = -EINVAL; mlog(ML_ERROR, "Unable to create per-mount debugfs root.\n"); goto read_super_error; @@ -1122,7 +1122,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) osb->osb_debug_root, osb, &ocfs2_osb_debug_fops); - if (IS_ERR_OR_NULL(osb->osb_ctxt)) { + if (!osb->osb_ctxt) { status = -EINVAL; mlog_errno(status); goto read_super_error; @@ -1606,9 +1606,8 @@ static int __init ocfs2_init(void) } ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL); - if (IS_ERR_OR_NULL(ocfs2_debugfs_root)) { - status = ocfs2_debugfs_root ? - PTR_ERR(ocfs2_debugfs_root) : -ENOMEM; + if (!ocfs2_debugfs_root) { + status = -ENOMEM; mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n"); goto out4; } -- cgit v1.2.3-59-g8ed1b