提交 fee1756d 编写于 作者: S Subodh Nijsure 提交者: Richard Weinberger

UBIFS: add ubifs_err() to print error reason

This patch adds ubifs_err() output to some error paths to tell the user
what's going on.

Artem: improve the messages, rename too long variable
Signed-off-by: NSubodh Nijsure <snijsure@grid-net.com>
Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: NBen Shelton <ben.shelton@ni.com>
Acked-by: NBrad Mouring <brad.mouring@ni.com>
Acked-by: NTerry Wilcox <terry.wilcox@ni.com>
Acked-by: NGratian Crisan <gratian.crisan@ni.com>
Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
上级 d7f0b70d
...@@ -100,24 +100,30 @@ static const struct file_operations empty_fops; ...@@ -100,24 +100,30 @@ static const struct file_operations empty_fops;
static int create_xattr(struct ubifs_info *c, struct inode *host, static int create_xattr(struct ubifs_info *c, struct inode *host,
const struct qstr *nm, const void *value, int size) const struct qstr *nm, const void *value, int size)
{ {
int err; int err, names_len;
struct inode *inode; struct inode *inode;
struct ubifs_inode *ui, *host_ui = ubifs_inode(host); struct ubifs_inode *ui, *host_ui = ubifs_inode(host);
struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1, struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
.new_ino_d = ALIGN(size, 8), .dirtied_ino = 1, .new_ino_d = ALIGN(size, 8), .dirtied_ino = 1,
.dirtied_ino_d = ALIGN(host_ui->data_len, 8) }; .dirtied_ino_d = ALIGN(host_ui->data_len, 8) };
if (host_ui->xattr_cnt >= MAX_XATTRS_PER_INODE) if (host_ui->xattr_cnt >= MAX_XATTRS_PER_INODE) {
ubifs_err("inode %lu already has too many xattrs (%d), cannot create more",
host->i_ino, host_ui->xattr_cnt);
return -ENOSPC; return -ENOSPC;
}
/* /*
* Linux limits the maximum size of the extended attribute names list * Linux limits the maximum size of the extended attribute names list
* to %XATTR_LIST_MAX. This means we should not allow creating more * to %XATTR_LIST_MAX. This means we should not allow creating more
* extended attributes if the name list becomes larger. This limitation * extended attributes if the name list becomes larger. This limitation
* is artificial for UBIFS, though. * is artificial for UBIFS, though.
*/ */
if (host_ui->xattr_names + host_ui->xattr_cnt + names_len = host_ui->xattr_names + host_ui->xattr_cnt + nm->len + 1;
nm->len + 1 > XATTR_LIST_MAX) if (names_len > XATTR_LIST_MAX) {
ubifs_err("cannot add one more xattr name to inode %lu, total names length would become %d, max. is %d",
host->i_ino, names_len, XATTR_LIST_MAX);
return -ENOSPC; return -ENOSPC;
}
err = ubifs_budget_space(c, &req); err = ubifs_budget_space(c, &req);
if (err) if (err)
...@@ -651,5 +657,8 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode, ...@@ -651,5 +657,8 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode,
&init_xattrs, 0); &init_xattrs, 0);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
if (err)
ubifs_err("cannot initialize security for inode %lu, error %d",
inode->i_ino, err);
return err; return err;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册