Re: [PATCH 4/4] UBIFS: add ubifs_err() to print error reason

2014-11-12 Thread Artem Bityutskiy
On Tue, 2014-11-11 at 10:08 -0600, Ben Shelton wrote:
> On 11/11, Artem Bityutskiy wrote:
> > Pushed this, but made some amendments.
> > 
> > Now all 4 are in the master branch. Would you please re-test them again
> > and confirm that they are fine. Then I'll push them to the linux-next
> > branch, unless you report that my amendments broke something.
> > 
> > Thank you!
> > 
> 
> Hi Artem,
> 
> I pulled the four modified commits into my 3.18-rc3 branch and tested
> with lockdep enabled.  Everything looks good.

OK, thank you!

--
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/


Re: [PATCH 4/4] UBIFS: add ubifs_err() to print error reason

2014-11-11 Thread Ben Shelton
On 11/11, Artem Bityutskiy wrote:
> Pushed this, but made some amendments.
> 
> Now all 4 are in the master branch. Would you please re-test them again
> and confirm that they are fine. Then I'll push them to the linux-next
> branch, unless you report that my amendments broke something.
> 
> Thank you!
> 

Hi Artem,

I pulled the four modified commits into my 3.18-rc3 branch and tested
with lockdep enabled.  Everything looks good.

Thanks,
Ben

--
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/


Re: [PATCH 4/4] UBIFS: add ubifs_err() to print error reason

2014-11-11 Thread Artem Bityutskiy
Pushed this, but made some amendments.

Now all 4 are in the master branch. Would you please re-test them again
and confirm that they are fine. Then I'll push them to the linux-next
branch, unless you report that my amendments broke something.

Thank you!

On Fri, 2014-10-31 at 13:50 -0500, Ben Shelton wrote:
> @@ -100,24 +100,32 @@ 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, xattr_name_list_size;

Renamed this to a shorter names_len.

> - 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);

Improved this message - made it more user-friendly, and print the inode
number.

> + if (xattr_name_list_size > XATTR_LIST_MAX) {
> + ubifs_err("xattr name list too large %d > %d",
> +   xattr_name_list_size, XATTR_LIST_MAX);
>   return -ENOSPC;

Ditto.
>  
> + if (err)
> + ubifs_err("cannot initialize extended attribute, error %d",
> +   err);

Refactored this message and added the inode number.

Artem.

--
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/


[PATCH 4/4] UBIFS: add ubifs_err() to print error reason

2014-10-31 Thread Ben Shelton
From: Subodh Nijsure 

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

Signed-off-by: Subodh Nijsure 
Signed-off-by: Marc Kleine-Budde 
Signed-off-by: Ben Shelton 
Acked-by: Brad Mouring 
Acked-by: Terry Wilcox 
Acked-by: Gratian Crisan 
---
 fs/ubifs/xattr.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index f844841..2b99e49 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -100,24 +100,32 @@ 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, xattr_name_list_size;
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("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
 * 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)
+   xattr_name_list_size = host_ui->xattr_names + host_ui->xattr_cnt +
+   nm->len + 1;
+
+   if (xattr_name_list_size > XATTR_LIST_MAX) {
+   ubifs_err("xattr name list too large %d > %d",
+ xattr_name_list_size, XATTR_LIST_MAX);
return -ENOSPC;
+   }
 
err = ubifs_budget_space(c, &req);
if (err)
@@ -652,5 +660,9 @@ int ubifs_init_security(struct inode *dentry, struct inode 
*inode,
   &ubifs_initxattrs, 0);
mutex_unlock(&inode->i_mutex);
 
+   if (err)
+   ubifs_err("cannot initialize extended attribute, error %d",
+ err);
+
return err;
 }
-- 
2.1.1

--
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/