summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-21 12:17:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-21 12:17:28 -0400
commit8f443e2372ba23d51ee365974f54507acd6f69d1 (patch)
tree45491c137f2d684a49a1f01046f1eda6398e2aac /fs/ocfs2/super.c
parent646da63172f660ba84f195c1165360a9b73583ee (diff)
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 <ying.huang@intel.com> Acked-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Chengyu Song <csong84@gatech.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r--fs/ocfs2/super.c9
1 files changed, 4 insertions, 5 deletions
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)
1112 1112
1113 osb->osb_debug_root = debugfs_create_dir(osb->uuid_str, 1113 osb->osb_debug_root = debugfs_create_dir(osb->uuid_str,
1114 ocfs2_debugfs_root); 1114 ocfs2_debugfs_root);
1115 if (IS_ERR_OR_NULL(osb->osb_debug_root)) { 1115 if (!osb->osb_debug_root) {
1116 status = -EINVAL; 1116 status = -EINVAL;
1117 mlog(ML_ERROR, "Unable to create per-mount debugfs root.\n"); 1117 mlog(ML_ERROR, "Unable to create per-mount debugfs root.\n");
1118 goto read_super_error; 1118 goto read_super_error;
@@ -1122,7 +1122,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
1122 osb->osb_debug_root, 1122 osb->osb_debug_root,
1123 osb, 1123 osb,
1124 &ocfs2_osb_debug_fops); 1124 &ocfs2_osb_debug_fops);
1125 if (IS_ERR_OR_NULL(osb->osb_ctxt)) { 1125 if (!osb->osb_ctxt) {
1126 status = -EINVAL; 1126 status = -EINVAL;
1127 mlog_errno(status); 1127 mlog_errno(status);
1128 goto read_super_error; 1128 goto read_super_error;
@@ -1606,9 +1606,8 @@ static int __init ocfs2_init(void)
1606 } 1606 }
1607 1607
1608 ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL); 1608 ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL);
1609 if (IS_ERR_OR_NULL(ocfs2_debugfs_root)) { 1609 if (!ocfs2_debugfs_root) {
1610 status = ocfs2_debugfs_root ? 1610 status = -ENOMEM;
1611 PTR_ERR(ocfs2_debugfs_root) : -ENOMEM;
1612 mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n"); 1611 mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
1613 goto out4; 1612 goto out4;
1614 } 1613 }