Commit ae9ff8ad authored by Eric Biggers's avatar Eric Biggers

fscrypt: adjust logging for in-creation inodes

Now that a fscrypt_info may be set up for inodes that are currently
being created and haven't yet had an inode number assigned, avoid
logging confusing messages about "inode 0".
Acked-by: default avatarJeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20200917041136.178600-7-ebiggers@kernel.orgSigned-off-by: default avatarEric Biggers <ebiggers@google.com>
parent 4c030fa8
...@@ -343,9 +343,11 @@ void fscrypt_msg(const struct inode *inode, const char *level, ...@@ -343,9 +343,11 @@ void fscrypt_msg(const struct inode *inode, const char *level,
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
if (inode) if (inode && inode->i_ino)
printk("%sfscrypt (%s, inode %lu): %pV\n", printk("%sfscrypt (%s, inode %lu): %pV\n",
level, inode->i_sb->s_id, inode->i_ino, &vaf); level, inode->i_sb->s_id, inode->i_ino, &vaf);
else if (inode)
printk("%sfscrypt (%s): %pV\n", level, inode->i_sb->s_id, &vaf);
else else
printk("%sfscrypt: %pV\n", level, &vaf); printk("%sfscrypt: %pV\n", level, &vaf);
va_end(args); va_end(args);
......
...@@ -817,6 +817,7 @@ static int check_for_busy_inodes(struct super_block *sb, ...@@ -817,6 +817,7 @@ static int check_for_busy_inodes(struct super_block *sb,
struct list_head *pos; struct list_head *pos;
size_t busy_count = 0; size_t busy_count = 0;
unsigned long ino; unsigned long ino;
char ino_str[50] = "";
spin_lock(&mk->mk_decrypted_inodes_lock); spin_lock(&mk->mk_decrypted_inodes_lock);
...@@ -838,11 +839,15 @@ static int check_for_busy_inodes(struct super_block *sb, ...@@ -838,11 +839,15 @@ static int check_for_busy_inodes(struct super_block *sb,
} }
spin_unlock(&mk->mk_decrypted_inodes_lock); spin_unlock(&mk->mk_decrypted_inodes_lock);
/* If the inode is currently being created, ino may still be 0. */
if (ino)
snprintf(ino_str, sizeof(ino_str), ", including ino %lu", ino);
fscrypt_warn(NULL, fscrypt_warn(NULL,
"%s: %zu inode(s) still busy after removing key with %s %*phN, including ino %lu", "%s: %zu inode(s) still busy after removing key with %s %*phN%s",
sb->s_id, busy_count, master_key_spec_type(&mk->mk_spec), sb->s_id, busy_count, master_key_spec_type(&mk->mk_spec),
master_key_spec_len(&mk->mk_spec), (u8 *)&mk->mk_spec.u, master_key_spec_len(&mk->mk_spec), (u8 *)&mk->mk_spec.u,
ino); ino_str);
return -EBUSY; return -EBUSY;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment