Commit 055adcbd authored by Joe Perches's avatar Joe Perches Committed by Jan Kara

quota: Use %pV and __attribute__((format (printf in __quota_error and fix fallout

Use %pV in __quota_error so a single printk can not be
interleaved with other logging messages.
Add __attribute__((format (printf, 3, 4))) so format
and arguments can be verified by compiler.
Make sure printk formats and arguments match.

Block # needed a pointer dereference.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 9c527492
...@@ -135,14 +135,18 @@ EXPORT_SYMBOL(dq_data_lock); ...@@ -135,14 +135,18 @@ EXPORT_SYMBOL(dq_data_lock);
void __quota_error(struct super_block *sb, const char *func, void __quota_error(struct super_block *sb, const char *func,
const char *fmt, ...) const char *fmt, ...)
{ {
if (printk_ratelimit()) {
va_list args; va_list args;
struct va_format vaf;
if (printk_ratelimit()) {
va_start(args, fmt); va_start(args, fmt);
printk(KERN_ERR "Quota error (device %s): %s: ",
sb->s_id, func); vaf.fmt = fmt;
vprintk(fmt, args); vaf.va = &args;
printk("\n");
printk(KERN_ERR "Quota error (device %s): %s: %pV\n",
sb->s_id, func, &vaf);
va_end(args); va_end(args);
} }
} }
......
...@@ -468,8 +468,8 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, ...@@ -468,8 +468,8 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
return -ENOMEM; return -ENOMEM;
ret = read_blk(info, *blk, buf); ret = read_blk(info, *blk, buf);
if (ret < 0) { if (ret < 0) {
quota_error(dquot->dq_sb, "Can't read quota data " quota_error(dquot->dq_sb, "Can't read quota data block %u",
"block %u", blk); *blk);
goto out_buf; goto out_buf;
} }
newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
...@@ -493,8 +493,9 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, ...@@ -493,8 +493,9 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
} else { } else {
ret = write_blk(info, *blk, buf); ret = write_blk(info, *blk, buf);
if (ret < 0) if (ret < 0)
quota_error(dquot->dq_sb, "Can't write quota " quota_error(dquot->dq_sb,
"tree block %u", blk); "Can't write quota tree block %u",
*blk);
} }
} }
out_buf: out_buf:
......
...@@ -31,7 +31,8 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) ...@@ -31,7 +31,8 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
#define quota_error(sb, fmt, args...) \ #define quota_error(sb, fmt, args...) \
__quota_error((sb), __func__, fmt , ## args) __quota_error((sb), __func__, fmt , ## args)
extern void __quota_error(struct super_block *sb, const char *func, extern __attribute__((format (printf, 3, 4)))
void __quota_error(struct super_block *sb, const char *func,
const char *fmt, ...); const char *fmt, ...);
/* /*
......
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