ext4: avoid output message interleaving in ext4_error_<foo>()
authorJoe Perches <joe@perches.com>
Tue, 20 Mar 2012 03:15:43 +0000 (23:15 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 Mar 2012 03:15:43 +0000 (23:15 -0400)
Using KERN_CONT means that messages from multiple threads may be
interleaved.  Avoid this by using a single printk call in
ext4_error_inode and ext4_error_file.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/super.c

index 25b1f03..11dfaad 100644 (file)
@@ -515,11 +515,16 @@ void ext4_error_inode(struct inode *inode, const char *function,
        va_start(args, fmt);
        vaf.fmt = fmt;
        vaf.va = &args;
-       printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: inode #%lu: ",
-              inode->i_sb->s_id, function, line, inode->i_ino);
        if (block)
-               printk(KERN_CONT "block %llu: ", block);
-       printk(KERN_CONT "comm %s: %pV\n", current->comm, &vaf);
+               printk(KERN_CRIT "EXT4-fs 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
+               printk(KERN_CRIT "EXT4-fs 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);
@@ -541,15 +546,21 @@ 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)";
-       printk(KERN_CRIT
-              "EXT4-fs error (device %s): %s:%d: inode #%lu: ",
-              inode->i_sb->s_id, function, line, inode->i_ino);
-       if (block)
-               printk(KERN_CONT "block %llu: ", block);
        va_start(args, fmt);
        vaf.fmt = fmt;
        vaf.va = &args;
-       printk(KERN_CONT "comm %s: path %s: %pV\n", current->comm, path, &vaf);
+       if (block)
+               printk(KERN_CRIT
+                      "EXT4-fs 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
+               printk(KERN_CRIT
+                      "EXT4-fs 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);