diff options
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/super.c | 47 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 5 |
3 files changed, 25 insertions, 28 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0d82922179db..e2f14b5258b6 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -340,6 +340,7 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes) | |||
340 | */ | 340 | */ |
341 | #define BTRFS_FS_STATE_ERROR 0 | 341 | #define BTRFS_FS_STATE_ERROR 0 |
342 | #define BTRFS_FS_STATE_REMOUNTING 1 | 342 | #define BTRFS_FS_STATE_REMOUNTING 1 |
343 | #define BTRFS_FS_STATE_TRANS_ABORTED 2 | ||
343 | 344 | ||
344 | /* Super block flags */ | 345 | /* Super block flags */ |
345 | /* Errors detected */ | 346 | /* Errors detected */ |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 8168ceca4754..7f00a91ccc10 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -64,9 +64,9 @@ | |||
64 | static const struct super_operations btrfs_super_ops; | 64 | static const struct super_operations btrfs_super_ops; |
65 | static struct file_system_type btrfs_fs_type; | 65 | static struct file_system_type btrfs_fs_type; |
66 | 66 | ||
67 | static const char *btrfs_decode_error(int errno, char nbuf[16]) | 67 | static const char *btrfs_decode_error(int errno) |
68 | { | 68 | { |
69 | char *errstr = NULL; | 69 | char *errstr = "unknown"; |
70 | 70 | ||
71 | switch (errno) { | 71 | switch (errno) { |
72 | case -EIO: | 72 | case -EIO: |
@@ -81,12 +81,6 @@ static const char *btrfs_decode_error(int errno, char nbuf[16]) | |||
81 | case -EEXIST: | 81 | case -EEXIST: |
82 | errstr = "Object already exists"; | 82 | errstr = "Object already exists"; |
83 | break; | 83 | break; |
84 | default: | ||
85 | if (nbuf) { | ||
86 | if (snprintf(nbuf, 16, "error %d", -errno) >= 0) | ||
87 | errstr = nbuf; | ||
88 | } | ||
89 | break; | ||
90 | } | 84 | } |
91 | 85 | ||
92 | return errstr; | 86 | return errstr; |
@@ -122,7 +116,6 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info) | |||
122 | * mounted writeable again, the device replace | 116 | * mounted writeable again, the device replace |
123 | * operation continues. | 117 | * operation continues. |
124 | */ | 118 | */ |
125 | // WARN_ON(1); | ||
126 | } | 119 | } |
127 | } | 120 | } |
128 | 121 | ||
@@ -135,7 +128,6 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, | |||
135 | unsigned int line, int errno, const char *fmt, ...) | 128 | unsigned int line, int errno, const char *fmt, ...) |
136 | { | 129 | { |
137 | struct super_block *sb = fs_info->sb; | 130 | struct super_block *sb = fs_info->sb; |
138 | char nbuf[16]; | ||
139 | const char *errstr; | 131 | const char *errstr; |
140 | 132 | ||
141 | /* | 133 | /* |
@@ -145,7 +137,7 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, | |||
145 | if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) | 137 | if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) |
146 | return; | 138 | return; |
147 | 139 | ||
148 | errstr = btrfs_decode_error(errno, nbuf); | 140 | errstr = btrfs_decode_error(errno); |
149 | if (fmt) { | 141 | if (fmt) { |
150 | struct va_format vaf; | 142 | struct va_format vaf; |
151 | va_list args; | 143 | va_list args; |
@@ -154,12 +146,12 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, | |||
154 | vaf.fmt = fmt; | 146 | vaf.fmt = fmt; |
155 | vaf.va = &args; | 147 | vaf.va = &args; |
156 | 148 | ||
157 | printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s (%pV)\n", | 149 | printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: errno=%d %s (%pV)\n", |
158 | sb->s_id, function, line, errstr, &vaf); | 150 | sb->s_id, function, line, errno, errstr, &vaf); |
159 | va_end(args); | 151 | va_end(args); |
160 | } else { | 152 | } else { |
161 | printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s\n", | 153 | printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: errno=%d %s\n", |
162 | sb->s_id, function, line, errstr); | 154 | sb->s_id, function, line, errno, errstr); |
163 | } | 155 | } |
164 | 156 | ||
165 | /* Don't go through full error handling during mount */ | 157 | /* Don't go through full error handling during mount */ |
@@ -248,17 +240,23 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans, | |||
248 | struct btrfs_root *root, const char *function, | 240 | struct btrfs_root *root, const char *function, |
249 | unsigned int line, int errno) | 241 | unsigned int line, int errno) |
250 | { | 242 | { |
251 | WARN_ONCE(1, KERN_DEBUG "btrfs: Transaction aborted\n"); | 243 | /* |
244 | * Report first abort since mount | ||
245 | */ | ||
246 | if (!test_and_set_bit(BTRFS_FS_STATE_TRANS_ABORTED, | ||
247 | &root->fs_info->fs_state)) { | ||
248 | WARN(1, KERN_DEBUG "btrfs: Transaction aborted (error %d)\n", | ||
249 | errno); | ||
250 | } | ||
252 | trans->aborted = errno; | 251 | trans->aborted = errno; |
253 | /* Nothing used. The other threads that have joined this | 252 | /* Nothing used. The other threads that have joined this |
254 | * transaction may be able to continue. */ | 253 | * transaction may be able to continue. */ |
255 | if (!trans->blocks_used) { | 254 | if (!trans->blocks_used) { |
256 | char nbuf[16]; | ||
257 | const char *errstr; | 255 | const char *errstr; |
258 | 256 | ||
259 | errstr = btrfs_decode_error(errno, nbuf); | 257 | errstr = btrfs_decode_error(errno); |
260 | btrfs_printk(root->fs_info, | 258 | btrfs_printk(root->fs_info, |
261 | "%s:%d: Aborting unused transaction(%s).\n", | 259 | "%s:%d: Aborting unused transaction (%s)\n", |
262 | function, line, errstr); | 260 | function, line, errstr); |
263 | return; | 261 | return; |
264 | } | 262 | } |
@@ -272,7 +270,6 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans, | |||
272 | void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, | 270 | void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, |
273 | unsigned int line, int errno, const char *fmt, ...) | 271 | unsigned int line, int errno, const char *fmt, ...) |
274 | { | 272 | { |
275 | char nbuf[16]; | ||
276 | char *s_id = "<unknown>"; | 273 | char *s_id = "<unknown>"; |
277 | const char *errstr; | 274 | const char *errstr; |
278 | struct va_format vaf = { .fmt = fmt }; | 275 | struct va_format vaf = { .fmt = fmt }; |
@@ -284,13 +281,13 @@ void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, | |||
284 | va_start(args, fmt); | 281 | va_start(args, fmt); |
285 | vaf.va = &args; | 282 | vaf.va = &args; |
286 | 283 | ||
287 | errstr = btrfs_decode_error(errno, nbuf); | 284 | errstr = btrfs_decode_error(errno); |
288 | if (fs_info && (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)) | 285 | if (fs_info && (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)) |
289 | panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (%s)\n", | 286 | panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (errno=%d %s)\n", |
290 | s_id, function, line, &vaf, errstr); | 287 | s_id, function, line, &vaf, errno, errstr); |
291 | 288 | ||
292 | printk(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (%s)\n", | 289 | printk(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (errno=%d %s)\n", |
293 | s_id, function, line, &vaf, errstr); | 290 | s_id, function, line, &vaf, errno, errstr); |
294 | va_end(args); | 291 | va_end(args); |
295 | /* Caller calls BUG() */ | 292 | /* Caller calls BUG() */ |
296 | } | 293 | } |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 50767bbaad6c..6c0a72ab6de0 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1808,7 +1808,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1808 | ret = btrfs_write_and_wait_transaction(trans, root); | 1808 | ret = btrfs_write_and_wait_transaction(trans, root); |
1809 | if (ret) { | 1809 | if (ret) { |
1810 | btrfs_error(root->fs_info, ret, | 1810 | btrfs_error(root->fs_info, ret, |
1811 | "Error while writing out transaction."); | 1811 | "Error while writing out transaction"); |
1812 | mutex_unlock(&root->fs_info->tree_log_mutex); | 1812 | mutex_unlock(&root->fs_info->tree_log_mutex); |
1813 | goto cleanup_transaction; | 1813 | goto cleanup_transaction; |
1814 | } | 1814 | } |
@@ -1864,8 +1864,7 @@ cleanup_transaction: | |||
1864 | btrfs_qgroup_free(root, trans->qgroup_reserved); | 1864 | btrfs_qgroup_free(root, trans->qgroup_reserved); |
1865 | trans->qgroup_reserved = 0; | 1865 | trans->qgroup_reserved = 0; |
1866 | } | 1866 | } |
1867 | btrfs_printk(root->fs_info, "Skipping commit of aborted transaction.\n"); | 1867 | btrfs_printk(root->fs_info, "Skipping commit of aborted transaction\n"); |
1868 | // WARN_ON(1); | ||
1869 | if (current->journal_info == trans) | 1868 | if (current->journal_info == trans) |
1870 | current->journal_info = NULL; | 1869 | current->journal_info = NULL; |
1871 | cleanup_transaction(trans, root, ret); | 1870 | cleanup_transaction(trans, root, ret); |