diff options
author | Subodh Nijsure <snijsure@grid-net.com> | 2014-10-31 14:50:31 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-01-28 10:09:01 -0500 |
commit | fee1756d80c24d5a3171cb9f76d612e512439dd2 (patch) | |
tree | 55e53842c031c0a465f1729c914c203dbbadbef6 /fs/ubifs/xattr.c | |
parent | d7f0b70d30ffb9bbe6b8a3e1035cf0b79965ef53 (diff) |
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>
Diffstat (limited to 'fs/ubifs/xattr.c')
-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; | |||
100 | static int create_xattr(struct ubifs_info *c, struct inode *host, | 100 | static int create_xattr(struct ubifs_info *c, struct inode *host, |
101 | const struct qstr *nm, const void *value, int size) | 101 | const struct qstr *nm, const void *value, int size) |
102 | { | 102 | { |
103 | int err; | 103 | int err, names_len; |
104 | struct inode *inode; | 104 | struct inode *inode; |
105 | struct ubifs_inode *ui, *host_ui = ubifs_inode(host); | 105 | struct ubifs_inode *ui, *host_ui = ubifs_inode(host); |
106 | struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1, | 106 | struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1, |
107 | .new_ino_d = ALIGN(size, 8), .dirtied_ino = 1, | 107 | .new_ino_d = ALIGN(size, 8), .dirtied_ino = 1, |
108 | .dirtied_ino_d = ALIGN(host_ui->data_len, 8) }; | 108 | .dirtied_ino_d = ALIGN(host_ui->data_len, 8) }; |
109 | 109 | ||
110 | if (host_ui->xattr_cnt >= MAX_XATTRS_PER_INODE) | 110 | if (host_ui->xattr_cnt >= MAX_XATTRS_PER_INODE) { |
111 | ubifs_err("inode %lu already has too many xattrs (%d), cannot create more", | ||
112 | host->i_ino, host_ui->xattr_cnt); | ||
111 | return -ENOSPC; | 113 | return -ENOSPC; |
114 | } | ||
112 | /* | 115 | /* |
113 | * Linux limits the maximum size of the extended attribute names list | 116 | * Linux limits the maximum size of the extended attribute names list |
114 | * to %XATTR_LIST_MAX. This means we should not allow creating more | 117 | * to %XATTR_LIST_MAX. This means we should not allow creating more |
115 | * extended attributes if the name list becomes larger. This limitation | 118 | * extended attributes if the name list becomes larger. This limitation |
116 | * is artificial for UBIFS, though. | 119 | * is artificial for UBIFS, though. |
117 | */ | 120 | */ |
118 | if (host_ui->xattr_names + host_ui->xattr_cnt + | 121 | names_len = host_ui->xattr_names + host_ui->xattr_cnt + nm->len + 1; |
119 | nm->len + 1 > XATTR_LIST_MAX) | 122 | if (names_len > XATTR_LIST_MAX) { |
123 | ubifs_err("cannot add one more xattr name to inode %lu, total names length would become %d, max. is %d", | ||
124 | host->i_ino, names_len, XATTR_LIST_MAX); | ||
120 | return -ENOSPC; | 125 | return -ENOSPC; |
126 | } | ||
121 | 127 | ||
122 | err = ubifs_budget_space(c, &req); | 128 | err = ubifs_budget_space(c, &req); |
123 | if (err) | 129 | if (err) |
@@ -651,5 +657,8 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode, | |||
651 | &init_xattrs, 0); | 657 | &init_xattrs, 0); |
652 | mutex_unlock(&inode->i_mutex); | 658 | mutex_unlock(&inode->i_mutex); |
653 | 659 | ||
660 | if (err) | ||
661 | ubifs_err("cannot initialize security for inode %lu, error %d", | ||
662 | inode->i_ino, err); | ||
654 | return err; | 663 | return err; |
655 | } | 664 | } |