[PATCH 5/9] ext4: Avoid output message interleaving in ext4_error_<foo>

From: Joe Perches
Date: Thu Mar 15 2012 - 20:08:53 EST


Using pr_cont means that messages from multiple threads
may be interleaved. Avoid this by using a single pr_<level>
call in ext4_error_inode and ext4_error_file.

Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
---
fs/ext4/super.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 4e1d656..ac77a95 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -517,11 +517,14 @@ void ext4_error_inode(struct inode *inode, const char *function,
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
- pr_crit("error (device %s): %s:%d: inode #%lu: ",
- inode->i_sb->s_id, function, line, inode->i_ino);
if (block)
- pr_cont("block %llu: ", block);
- pr_cont("comm %s: %pV\n", current->comm, &vaf);
+ pr_crit("error (device %s): %s:%d: inode #%lu: block %llu: comm %s: %pV\n",
+ inode->i_sb->s_id, function, line, inode->i_ino,
+ block, current->comm, &vaf);
+ else
+ pr_crit("error (device %s): %s:%d: inode #%lu: comm %s: %pV\n",
+ inode->i_sb->s_id, function, line, inode->i_ino,
+ current->comm, &vaf);
va_end(args);

ext4_handle_error(inode->i_sb);
@@ -543,14 +546,17 @@ void ext4_error_file(struct file *file, const char *function,
path = d_path(&(file->f_path), pathname, sizeof(pathname));
if (IS_ERR(path))
path = "(unknown)";
- pr_crit("error (device %s): %s:%d: inode #%lu: ",
- inode->i_sb->s_id, function, line, inode->i_ino);
- if (block)
- pr_cont("block %llu: ", block);
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
- pr_cont("comm %s: path %s: %pV\n", current->comm, path, &vaf);
+ if (block)
+ pr_crit("error (device %s): %s:%d: inode #%lu: block %llu: comm %s: path %s: %pV\n",
+ inode->i_sb->s_id, function, line, inode->i_ino,
+ block, current->comm, path, &vaf);
+ else
+ pr_crit("error (device %s): %s:%d: inode #%lu: comm %s: path %s: %pV\n",
+ inode->i_sb->s_id, function, line, inode->i_ino,
+ current->comm, path, &vaf);
va_end(args);

ext4_handle_error(inode->i_sb);
--
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/