diff options
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 26675185b886..837ddce4b659 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 (!osb->osb_debug_root) { | 1115 | if (IS_ERR_OR_NULL(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 (!osb->osb_ctxt) { | 1125 | if (IS_ERR_OR_NULL(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,8 +1606,9 @@ 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 (!ocfs2_debugfs_root) { | 1609 | if (IS_ERR_OR_NULL(ocfs2_debugfs_root)) { |
1610 | status = -ENOMEM; | 1610 | status = ocfs2_debugfs_root ? |
1611 | PTR_ERR(ocfs2_debugfs_root) : -ENOMEM; | ||
1611 | mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n"); | 1612 | mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n"); |
1612 | goto out4; | 1613 | goto out4; |
1613 | } | 1614 | } |
@@ -2069,6 +2070,8 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2069 | cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits); | 2070 | cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits); |
2070 | bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits); | 2071 | bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits); |
2071 | sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits); | 2072 | sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits); |
2073 | memcpy(sb->s_uuid, di->id2.i_super.s_uuid, | ||
2074 | sizeof(di->id2.i_super.s_uuid)); | ||
2072 | 2075 | ||
2073 | osb->osb_dx_mask = (1 << (cbits - bbits)) - 1; | 2076 | osb->osb_dx_mask = (1 << (cbits - bbits)) - 1; |
2074 | 2077 | ||
@@ -2333,7 +2336,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2333 | mlog_errno(status); | 2336 | mlog_errno(status); |
2334 | goto bail; | 2337 | goto bail; |
2335 | } | 2338 | } |
2336 | cleancache_init_shared_fs((char *)&di->id2.i_super.s_uuid, sb); | 2339 | cleancache_init_shared_fs(sb); |
2337 | 2340 | ||
2338 | bail: | 2341 | bail: |
2339 | return status; | 2342 | return status; |
@@ -2563,22 +2566,22 @@ static void ocfs2_handle_error(struct super_block *sb) | |||
2563 | ocfs2_set_ro_flag(osb, 0); | 2566 | ocfs2_set_ro_flag(osb, 0); |
2564 | } | 2567 | } |
2565 | 2568 | ||
2566 | static char error_buf[1024]; | 2569 | void __ocfs2_error(struct super_block *sb, const char *function, |
2567 | 2570 | const char *fmt, ...) | |
2568 | void __ocfs2_error(struct super_block *sb, | ||
2569 | const char *function, | ||
2570 | const char *fmt, ...) | ||
2571 | { | 2571 | { |
2572 | struct va_format vaf; | ||
2572 | va_list args; | 2573 | va_list args; |
2573 | 2574 | ||
2574 | va_start(args, fmt); | 2575 | va_start(args, fmt); |
2575 | vsnprintf(error_buf, sizeof(error_buf), fmt, args); | 2576 | vaf.fmt = fmt; |
2576 | va_end(args); | 2577 | vaf.va = &args; |
2577 | 2578 | ||
2578 | /* Not using mlog here because we want to show the actual | 2579 | /* Not using mlog here because we want to show the actual |
2579 | * function the error came from. */ | 2580 | * function the error came from. */ |
2580 | printk(KERN_CRIT "OCFS2: ERROR (device %s): %s: %s\n", | 2581 | printk(KERN_CRIT "OCFS2: ERROR (device %s): %s: %pV\n", |
2581 | sb->s_id, function, error_buf); | 2582 | sb->s_id, function, &vaf); |
2583 | |||
2584 | va_end(args); | ||
2582 | 2585 | ||
2583 | ocfs2_handle_error(sb); | 2586 | ocfs2_handle_error(sb); |
2584 | } | 2587 | } |
@@ -2586,18 +2589,21 @@ void __ocfs2_error(struct super_block *sb, | |||
2586 | /* Handle critical errors. This is intentionally more drastic than | 2589 | /* Handle critical errors. This is intentionally more drastic than |
2587 | * ocfs2_handle_error, so we only use for things like journal errors, | 2590 | * ocfs2_handle_error, so we only use for things like journal errors, |
2588 | * etc. */ | 2591 | * etc. */ |
2589 | void __ocfs2_abort(struct super_block* sb, | 2592 | void __ocfs2_abort(struct super_block *sb, const char *function, |
2590 | const char *function, | ||
2591 | const char *fmt, ...) | 2593 | const char *fmt, ...) |
2592 | { | 2594 | { |
2595 | struct va_format vaf; | ||
2593 | va_list args; | 2596 | va_list args; |
2594 | 2597 | ||
2595 | va_start(args, fmt); | 2598 | va_start(args, fmt); |
2596 | vsnprintf(error_buf, sizeof(error_buf), fmt, args); | ||
2597 | va_end(args); | ||
2598 | 2599 | ||
2599 | printk(KERN_CRIT "OCFS2: abort (device %s): %s: %s\n", | 2600 | vaf.fmt = fmt; |
2600 | sb->s_id, function, error_buf); | 2601 | vaf.va = &args; |
2602 | |||
2603 | printk(KERN_CRIT "OCFS2: abort (device %s): %s: %pV\n", | ||
2604 | sb->s_id, function, &vaf); | ||
2605 | |||
2606 | va_end(args); | ||
2601 | 2607 | ||
2602 | /* We don't have the cluster support yet to go straight to | 2608 | /* We don't have the cluster support yet to go straight to |
2603 | * hard readonly in here. Until then, we want to keep | 2609 | * hard readonly in here. Until then, we want to keep |