From: Subodh Nijsure <snijs...@grid-net.com>

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

Signed-off-by: Subodh Nijsure <snijs...@grid-net.com>
Signed-off-by: Marc Kleine-Budde <m...@pengutronix.de>
---
 fs/ubifs/dir.c   |   20 ++++++++++++++++----
 fs/ubifs/xattr.c |   12 ++++++++++--
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 6aa31b5..d0dd7a9 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -282,8 +282,11 @@ static int ubifs_create(struct inode *dir, struct dentry 
*dentry, umode_t mode,
                goto out_cancel;
 
        err = ubifs_init_security(dir, inode, &dentry->d_name);
-       if (err)
+       if (err) {
+               ubifs_err("cannot initialize extended attribute, error %d",
+                         err);
                goto out_cancel;
+       }
        mutex_unlock(&dir_ui->ui_mutex);
 
        ubifs_release_budget(c, &req);
@@ -748,8 +751,11 @@ static int ubifs_mkdir(struct inode *dir, struct dentry 
*dentry, umode_t mode)
        }
 
        err = ubifs_init_security(dir, inode, &dentry->d_name);
-       if (err)
+       if (err) {
+               ubifs_err("cannot initialize extended attribute, error %d",
+                         err);
                goto out_cancel;
+       }
        mutex_unlock(&dir_ui->ui_mutex);
 
        ubifs_release_budget(c, &req);
@@ -828,8 +834,11 @@ static int ubifs_mknod(struct inode *dir, struct dentry 
*dentry,
                goto out_cancel;
 
        err = ubifs_init_security(dir, inode, &dentry->d_name);
-       if (err)
+       if (err) {
+               ubifs_err("cannot initialize extended attribute, error %d",
+                         err);
                goto out_cancel;
+       }
        mutex_unlock(&dir_ui->ui_mutex);
 
        ubifs_release_budget(c, &req);
@@ -908,8 +917,11 @@ static int ubifs_symlink(struct inode *dir, struct dentry 
*dentry,
                goto out_cancel;
 
        err = ubifs_init_security(dir, inode, &dentry->d_name);
-       if (err)
+       if (err) {
+               ubifs_err("cannot initialize extended attribute, error %d",
+                         err);
                goto out_cancel;
+       }
        mutex_unlock(&dir_ui->ui_mutex);
 
        ubifs_release_budget(c, &req);
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index aa81bd3..380fcc9 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -107,8 +107,11 @@ static int create_xattr(struct ubifs_info *c, struct inode 
*host,
                                .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("ubifs xattr_cnt %d exceeds MAX_XATTR_PER_NODE (%d)",
+                         host_ui->xattr_cnt, MAX_XATTRS_PER_INODE);
                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
@@ -116,8 +119,13 @@ static int create_xattr(struct ubifs_info *c, struct inode 
*host,
         * is artificial for UBIFS, though.
         */
        if (host_ui->xattr_names + host_ui->xattr_cnt +
-                                       nm->len + 1 > XATTR_LIST_MAX)
+                                       nm->len + 1 > XATTR_LIST_MAX) {
+               ubifs_err("xattr name list too large %d > %d",
+                         host_ui->xattr_names + host_ui->xattr_cnt +
+                         nm->len + 1,
+                         XATTR_LIST_MAX);
                return -ENOSPC;
+       }
 
        err = ubifs_budget_space(c, &req);
        if (err)
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to