ext4: Use ext4_error_file() to print the pathname to the corrupted inode
Where the file pointer is available, use ext4_error_file() instead of ext4_error_inode(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
@ -406,28 +406,31 @@ void ext4_error_inode(struct inode *inode, const char *function,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
struct va_format vaf;
|
||||
struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
|
||||
|
||||
es->s_last_error_ino = cpu_to_le32(inode->i_ino);
|
||||
es->s_last_error_block = cpu_to_le64(block);
|
||||
save_error_info(inode->i_sb, function, line);
|
||||
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("block %llu: ", block);
|
||||
printk("comm %s: ", current->comm);
|
||||
vprintk(fmt, args);
|
||||
printk("\n");
|
||||
printk(KERN_CONT "block %llu: ", block);
|
||||
printk(KERN_CONT "comm %s: %pV\n", current->comm, &vaf);
|
||||
va_end(args);
|
||||
|
||||
ext4_handle_error(inode->i_sb);
|
||||
}
|
||||
|
||||
void ext4_error_file(struct file *file, const char *function,
|
||||
unsigned int line, const char *fmt, ...)
|
||||
unsigned int line, ext4_fsblk_t block,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
struct va_format vaf;
|
||||
struct ext4_super_block *es;
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
char pathname[80], *path;
|
||||
@ -435,17 +438,18 @@ void ext4_error_file(struct file *file, const char *function,
|
||||
es = EXT4_SB(inode->i_sb)->s_es;
|
||||
es->s_last_error_ino = cpu_to_le32(inode->i_ino);
|
||||
save_error_info(inode->i_sb, function, line);
|
||||
va_start(args, fmt);
|
||||
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 "
|
||||
"(comm %s path %s): ",
|
||||
inode->i_sb->s_id, function, line, inode->i_ino,
|
||||
current->comm, path);
|
||||
vprintk(fmt, args);
|
||||
printk("\n");
|
||||
"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);
|
||||
va_end(args);
|
||||
|
||||
ext4_handle_error(inode->i_sb);
|
||||
|
Reference in New Issue
Block a user