diff options
Diffstat (limited to 'fs/gfs2/util.c')
| -rw-r--r-- | fs/gfs2/util.c | 101 |
1 files changed, 48 insertions, 53 deletions
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index f7109f689e61..86d2035ac669 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 11 | |||
| 10 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
| 11 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
| 12 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
| @@ -30,22 +32,27 @@ mempool_t *gfs2_page_pool __read_mostly; | |||
| 30 | 32 | ||
| 31 | void gfs2_assert_i(struct gfs2_sbd *sdp) | 33 | void gfs2_assert_i(struct gfs2_sbd *sdp) |
| 32 | { | 34 | { |
| 33 | printk(KERN_EMERG "GFS2: fsid=%s: fatal assertion failed\n", | 35 | fs_emerg(sdp, "fatal assertion failed\n"); |
| 34 | sdp->sd_fsname); | ||
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...) | 38 | int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...) |
| 38 | { | 39 | { |
| 39 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; | 40 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; |
| 40 | const struct lm_lockops *lm = ls->ls_ops; | 41 | const struct lm_lockops *lm = ls->ls_ops; |
| 41 | va_list args; | 42 | va_list args; |
| 43 | struct va_format vaf; | ||
| 42 | 44 | ||
| 43 | if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW && | 45 | if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW && |
| 44 | test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags)) | 46 | test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags)) |
| 45 | return 0; | 47 | return 0; |
| 46 | 48 | ||
| 47 | va_start(args, fmt); | 49 | va_start(args, fmt); |
| 48 | vprintk(fmt, args); | 50 | |
| 51 | vaf.fmt = fmt; | ||
| 52 | vaf.va = &args; | ||
| 53 | |||
| 54 | fs_err(sdp, "%pV", &vaf); | ||
| 55 | |||
| 49 | va_end(args); | 56 | va_end(args); |
| 50 | 57 | ||
| 51 | if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) { | 58 | if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) { |
| @@ -66,7 +73,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...) | |||
| 66 | } | 73 | } |
| 67 | 74 | ||
| 68 | if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC) | 75 | if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC) |
| 69 | panic("GFS2: fsid=%s: panic requested.\n", sdp->sd_fsname); | 76 | panic("GFS2: fsid=%s: panic requested\n", sdp->sd_fsname); |
| 70 | 77 | ||
| 71 | return -1; | 78 | return -1; |
| 72 | } | 79 | } |
| @@ -82,10 +89,9 @@ int gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion, | |||
| 82 | { | 89 | { |
| 83 | int me; | 90 | int me; |
| 84 | me = gfs2_lm_withdraw(sdp, | 91 | me = gfs2_lm_withdraw(sdp, |
| 85 | "GFS2: fsid=%s: fatal: assertion \"%s\" failed\n" | 92 | "fatal: assertion \"%s\" failed\n" |
| 86 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 93 | " function = %s, file = %s, line = %u\n", |
| 87 | sdp->sd_fsname, assertion, | 94 | assertion, function, file, line); |
| 88 | sdp->sd_fsname, function, file, line); | ||
| 89 | dump_stack(); | 95 | dump_stack(); |
| 90 | return (me) ? -1 : -2; | 96 | return (me) ? -1 : -2; |
| 91 | } | 97 | } |
| @@ -105,11 +111,8 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion, | |||
| 105 | return -2; | 111 | return -2; |
| 106 | 112 | ||
| 107 | if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) | 113 | if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) |
| 108 | printk(KERN_WARNING | 114 | fs_warn(sdp, "warning: assertion \"%s\" failed at function = %s, file = %s, line = %u\n", |
| 109 | "GFS2: fsid=%s: warning: assertion \"%s\" failed\n" | 115 | assertion, function, file, line); |
| 110 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | ||
| 111 | sdp->sd_fsname, assertion, | ||
| 112 | sdp->sd_fsname, function, file, line); | ||
| 113 | 116 | ||
| 114 | if (sdp->sd_args.ar_debug) | 117 | if (sdp->sd_args.ar_debug) |
| 115 | BUG(); | 118 | BUG(); |
| @@ -138,10 +141,8 @@ int gfs2_consist_i(struct gfs2_sbd *sdp, int cluster_wide, const char *function, | |||
| 138 | { | 141 | { |
| 139 | int rv; | 142 | int rv; |
| 140 | rv = gfs2_lm_withdraw(sdp, | 143 | rv = gfs2_lm_withdraw(sdp, |
| 141 | "GFS2: fsid=%s: fatal: filesystem consistency error\n" | 144 | "fatal: filesystem consistency error - function = %s, file = %s, line = %u\n", |
| 142 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 145 | function, file, line); |
| 143 | sdp->sd_fsname, | ||
| 144 | sdp->sd_fsname, function, file, line); | ||
| 145 | return rv; | 146 | return rv; |
| 146 | } | 147 | } |
| 147 | 148 | ||
| @@ -157,13 +158,12 @@ int gfs2_consist_inode_i(struct gfs2_inode *ip, int cluster_wide, | |||
| 157 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 158 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
| 158 | int rv; | 159 | int rv; |
| 159 | rv = gfs2_lm_withdraw(sdp, | 160 | rv = gfs2_lm_withdraw(sdp, |
| 160 | "GFS2: fsid=%s: fatal: filesystem consistency error\n" | 161 | "fatal: filesystem consistency error\n" |
| 161 | "GFS2: fsid=%s: inode = %llu %llu\n" | 162 | " inode = %llu %llu\n" |
| 162 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 163 | " function = %s, file = %s, line = %u\n", |
| 163 | sdp->sd_fsname, | 164 | (unsigned long long)ip->i_no_formal_ino, |
| 164 | sdp->sd_fsname, (unsigned long long)ip->i_no_formal_ino, | 165 | (unsigned long long)ip->i_no_addr, |
| 165 | (unsigned long long)ip->i_no_addr, | 166 | function, file, line); |
| 166 | sdp->sd_fsname, function, file, line); | ||
| 167 | return rv; | 167 | return rv; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| @@ -179,12 +179,11 @@ int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide, | |||
| 179 | struct gfs2_sbd *sdp = rgd->rd_sbd; | 179 | struct gfs2_sbd *sdp = rgd->rd_sbd; |
| 180 | int rv; | 180 | int rv; |
| 181 | rv = gfs2_lm_withdraw(sdp, | 181 | rv = gfs2_lm_withdraw(sdp, |
| 182 | "GFS2: fsid=%s: fatal: filesystem consistency error\n" | 182 | "fatal: filesystem consistency error\n" |
| 183 | "GFS2: fsid=%s: RG = %llu\n" | 183 | " RG = %llu\n" |
| 184 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 184 | " function = %s, file = %s, line = %u\n", |
| 185 | sdp->sd_fsname, | 185 | (unsigned long long)rgd->rd_addr, |
| 186 | sdp->sd_fsname, (unsigned long long)rgd->rd_addr, | 186 | function, file, line); |
| 187 | sdp->sd_fsname, function, file, line); | ||
| 188 | return rv; | 187 | return rv; |
| 189 | } | 188 | } |
| 190 | 189 | ||
| @@ -200,12 +199,11 @@ int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
| 200 | { | 199 | { |
| 201 | int me; | 200 | int me; |
| 202 | me = gfs2_lm_withdraw(sdp, | 201 | me = gfs2_lm_withdraw(sdp, |
| 203 | "GFS2: fsid=%s: fatal: invalid metadata block\n" | 202 | "fatal: invalid metadata block\n" |
| 204 | "GFS2: fsid=%s: bh = %llu (%s)\n" | 203 | " bh = %llu (%s)\n" |
| 205 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 204 | " function = %s, file = %s, line = %u\n", |
| 206 | sdp->sd_fsname, | 205 | (unsigned long long)bh->b_blocknr, type, |
| 207 | sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type, | 206 | function, file, line); |
| 208 | sdp->sd_fsname, function, file, line); | ||
| 209 | return (me) ? -1 : -2; | 207 | return (me) ? -1 : -2; |
| 210 | } | 208 | } |
| 211 | 209 | ||
| @@ -221,12 +219,11 @@ int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
| 221 | { | 219 | { |
| 222 | int me; | 220 | int me; |
| 223 | me = gfs2_lm_withdraw(sdp, | 221 | me = gfs2_lm_withdraw(sdp, |
| 224 | "GFS2: fsid=%s: fatal: invalid metadata block\n" | 222 | "fatal: invalid metadata block\n" |
| 225 | "GFS2: fsid=%s: bh = %llu (type: exp=%u, found=%u)\n" | 223 | " bh = %llu (type: exp=%u, found=%u)\n" |
| 226 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 224 | " function = %s, file = %s, line = %u\n", |
| 227 | sdp->sd_fsname, | 225 | (unsigned long long)bh->b_blocknr, type, t, |
| 228 | sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type, t, | 226 | function, file, line); |
| 229 | sdp->sd_fsname, function, file, line); | ||
| 230 | return (me) ? -1 : -2; | 227 | return (me) ? -1 : -2; |
| 231 | } | 228 | } |
| 232 | 229 | ||
| @@ -241,10 +238,9 @@ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file, | |||
| 241 | { | 238 | { |
| 242 | int rv; | 239 | int rv; |
| 243 | rv = gfs2_lm_withdraw(sdp, | 240 | rv = gfs2_lm_withdraw(sdp, |
| 244 | "GFS2: fsid=%s: fatal: I/O error\n" | 241 | "fatal: I/O error\n" |
| 245 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 242 | " function = %s, file = %s, line = %u\n", |
| 246 | sdp->sd_fsname, | 243 | function, file, line); |
| 247 | sdp->sd_fsname, function, file, line); | ||
| 248 | return rv; | 244 | return rv; |
| 249 | } | 245 | } |
| 250 | 246 | ||
| @@ -259,12 +255,11 @@ int gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
| 259 | { | 255 | { |
| 260 | int rv; | 256 | int rv; |
| 261 | rv = gfs2_lm_withdraw(sdp, | 257 | rv = gfs2_lm_withdraw(sdp, |
| 262 | "GFS2: fsid=%s: fatal: I/O error\n" | 258 | "fatal: I/O error\n" |
| 263 | "GFS2: fsid=%s: block = %llu\n" | 259 | " block = %llu\n" |
| 264 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 260 | " function = %s, file = %s, line = %u\n", |
| 265 | sdp->sd_fsname, | 261 | (unsigned long long)bh->b_blocknr, |
| 266 | sdp->sd_fsname, (unsigned long long)bh->b_blocknr, | 262 | function, file, line); |
| 267 | sdp->sd_fsname, function, file, line); | ||
| 268 | return rv; | 263 | return rv; |
| 269 | } | 264 | } |
| 270 | 265 | ||
