diff options
author | Subodh Nijsure <snijsure@grid-net.com> | 2014-10-31 13:50:31 -0500 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-01-28 16:09:01 +0100 |
commit | fee1756d80c24d5a3171cb9f76d612e512439dd2 (patch) | |
tree | 55e53842c031c0a465f1729c914c203dbbadbef6 | |
parent | d7f0b70d30ffb9bbe6b8a3e1035cf0b79965ef53 (diff) | |
download | linux-fee1756d80c24d5a3171cb9f76d612e512439dd2.tar.bz2 |
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: Subodh Nijsure <snijsure@grid-net.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Acked-by: Brad Mouring <brad.mouring@ni.com>
Acked-by: Terry Wilcox <terry.wilcox@ni.com>
Acked-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r-- | fs/ubifs/xattr.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index 2bdab8b11f3f..a92be244a6fb 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -100,24 +100,30 @@ static const struct file_operations empty_fops; static int create_xattr(struct ubifs_info *c, struct inode *host, const struct qstr *nm, const void *value, int size) { - int err; + int err, names_len; struct inode *inode; struct ubifs_inode *ui, *host_ui = ubifs_inode(host); struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1, .new_ino_d = ALIGN(size, 8), .dirtied_ino = 1, .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; + } /* * Linux limits the maximum size of the extended attribute names list * to %XATTR_LIST_MAX. This means we should not allow creating more * extended attributes if the name list becomes larger. This limitation * is artificial for UBIFS, though. */ - if (host_ui->xattr_names + host_ui->xattr_cnt + - nm->len + 1 > XATTR_LIST_MAX) + names_len = host_ui->xattr_names + host_ui->xattr_cnt + nm->len + 1; + 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; + } err = ubifs_budget_space(c, &req); if (err) @@ -651,5 +657,8 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode, &init_xattrs, 0); mutex_unlock(&inode->i_mutex); + if (err) + ubifs_err("cannot initialize security for inode %lu, error %d", + inode->i_ino, err); return err; } |