* fix the ext4_read_inline_dir return value
@ 2013-09-17 15:08 Boxi Liu
2013-09-17 16:29 ` Jan Kara
0 siblings, 1 reply; 9+ messages in thread
From: Boxi Liu @ 2013-09-17 15:08 UTC (permalink / raw)
To: linux-ext4@vger.kernel.org, Theodore Tso, Robin Dong, tm@tao.ma,
lewis.liulei, pamirs
hi,
there may be a bug in ext4_read_inline_dir() function with inline_data feature.
when I recursion call a sys_old_readdir to read a direntry's
sub_dentry,I find that the ext4_read_inline_dir return the len of the
inline_data ,but in the no inline_data case,it will return 0.It is
inconsistent.
So I try to make a patch to fix it.
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index d9ecbf1..3ea39cd 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1441,7 +1441,7 @@ int ext4_read_inline_dir(struct file *file,
up_read(&EXT4_I(inode)->xattr_sem);
if (ret < 0)
goto out;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: fix the ext4_read_inline_dir return value
2013-09-17 15:08 fix the ext4_read_inline_dir return value Boxi Liu
@ 2013-09-17 16:29 ` Jan Kara
2013-09-17 17:30 ` Boxi Liu
0 siblings, 1 reply; 9+ messages in thread
From: Jan Kara @ 2013-09-17 16:29 UTC (permalink / raw)
To: Boxi Liu
Cc: linux-ext4@vger.kernel.org, Theodore Tso, Robin Dong, tm@tao.ma,
lewis.liulei, pamirs
On Tue 17-09-13 23:08:51, Boxi Liu wrote:
> hi,
> there may be a bug in ext4_read_inline_dir() function with inline_data feature.
> when I recursion call a sys_old_readdir to read a direntry's
> sub_dentry,I find that the ext4_read_inline_dir return the len of the
> inline_data ,but in the no inline_data case,it will return 0.It is
> inconsistent.
> So I try to make a patch to fix it.
The patch is fine, thanks for finding the bug. But please read
Documentation/SubmittingPatches about how your patch should be formatted.
In particular your patch has damaged whitespace (tabs converted to spaces).
Gmail does this - you have to send the patch as an attachment to avoid this
when using gmail. Also your patch misses Signed-off-by line.
Honza
>
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index d9ecbf1..3ea39cd 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -1441,7 +1441,7 @@ int ext4_read_inline_dir(struct file *file,
> up_read(&EXT4_I(inode)->xattr_sem);
> if (ret < 0)
> goto out;
> -
> + ret = 0;
> sb = inode->i_sb;
> parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode);
> offset = ctx->pos;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: fix the ext4_read_inline_dir return value
2013-09-17 16:29 ` Jan Kara
@ 2013-09-17 17:30 ` Boxi Liu
2013-09-17 17:38 ` Jan Kara
0 siblings, 1 reply; 9+ messages in thread
From: Boxi Liu @ 2013-09-17 17:30 UTC (permalink / raw)
To: Jan Kara
Cc: linux-ext4@vger.kernel.org, Theodore Tso, Robin Dong, tm@tao.ma,
lewis.liulei, pamirs
Thanks to point the that,I will fix it.
ext4: fix the ext4_read_inline_dir return value
In ext4_read_inlne_dir,the return value is the return
of ext4_read_inline_data len.But in no inline_data case,
the return value is 0,it's inconsistent.So fix the return
value of ext4_read_inline_dir.
Signed-off-by: BoxiLiu <lewis.liulei@huawei.com>
---
fs/ext4/inline.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index d9ecbf1..c3efb65 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1442,6 +1442,7 @@ int ext4_read_inline_dir(struct file *file,
if (ret < 0)
goto out;
+ ret = 0;
sb = inode->i_sb;
parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode);
offset = ctx->pos;
--
2013/9/18 Jan Kara <jack@suse.cz>:
> On Tue 17-09-13 23:08:51, Boxi Liu wrote:
>> hi,
>> there may be a bug in ext4_read_inline_dir() function with inline_data feature.
>> when I recursion call a sys_old_readdir to read a direntry's
>> sub_dentry,I find that the ext4_read_inline_dir return the len of the
>> inline_data ,but in the no inline_data case,it will return 0.It is
>> inconsistent.
>> So I try to make a patch to fix it.
> The patch is fine, thanks for finding the bug. But please read
> Documentation/SubmittingPatches about how your patch should be formatted.
> In particular your patch has damaged whitespace (tabs converted to spaces).
> Gmail does this - you have to send the patch as an attachment to avoid this
> when using gmail. Also your patch misses Signed-off-by line.
>
> Honza
>>
>> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
>> index d9ecbf1..3ea39cd 100644
>> --- a/fs/ext4/inline.c
>> +++ b/fs/ext4/inline.c
>> @@ -1441,7 +1441,7 @@ int ext4_read_inline_dir(struct file *file,
>> up_read(&EXT4_I(inode)->xattr_sem);
>> if (ret < 0)
>> goto out;
>> -
>> + ret = 0;
>> sb = inode->i_sb;
>> parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode);
>> offset = ctx->pos;
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: fix the ext4_read_inline_dir return value
2013-09-17 17:30 ` Boxi Liu
@ 2013-09-17 17:38 ` Jan Kara
0 siblings, 0 replies; 9+ messages in thread
From: Jan Kara @ 2013-09-17 17:38 UTC (permalink / raw)
To: Boxi Liu
Cc: Jan Kara, linux-ext4@vger.kernel.org, Theodore Tso, Robin Dong,
tm@tao.ma, lewis.liulei, pamirs
On Wed 18-09-13 01:30:36, Boxi Liu wrote:
> Thanks to point the that,I will fix it.
You have added the Signed-off-by line but whitespace is still damaged.
You really have to add the patch as an attachment to the email when using
gmail. Also please send patches as separate emails not as a reply to some
email. That way maintainer (Ted Tso in this case) is much less likely to
miss the patch. Thanks.
Honza
>
> ext4: fix the ext4_read_inline_dir return value
>
> In ext4_read_inlne_dir,the return value is the return
> of ext4_read_inline_data len.But in no inline_data case,
> the return value is 0,it's inconsistent.So fix the return
> value of ext4_read_inline_dir.
>
> Signed-off-by: BoxiLiu <lewis.liulei@huawei.com>
> ---
> fs/ext4/inline.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index d9ecbf1..c3efb65 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -1442,6 +1442,7 @@ int ext4_read_inline_dir(struct file *file,
> if (ret < 0)
> goto out;
>
> + ret = 0;
> sb = inode->i_sb;
> parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode);
> offset = ctx->pos;
> --
>
> 2013/9/18 Jan Kara <jack@suse.cz>:
> > On Tue 17-09-13 23:08:51, Boxi Liu wrote:
> >> hi,
> >> there may be a bug in ext4_read_inline_dir() function with inline_data feature.
> >> when I recursion call a sys_old_readdir to read a direntry's
> >> sub_dentry,I find that the ext4_read_inline_dir return the len of the
> >> inline_data ,but in the no inline_data case,it will return 0.It is
> >> inconsistent.
> >> So I try to make a patch to fix it.
> > The patch is fine, thanks for finding the bug. But please read
> > Documentation/SubmittingPatches about how your patch should be formatted.
> > In particular your patch has damaged whitespace (tabs converted to spaces).
> > Gmail does this - you have to send the patch as an attachment to avoid this
> > when using gmail. Also your patch misses Signed-off-by line.
> >
> > Honza
> >>
> >> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> >> index d9ecbf1..3ea39cd 100644
> >> --- a/fs/ext4/inline.c
> >> +++ b/fs/ext4/inline.c
> >> @@ -1441,7 +1441,7 @@ int ext4_read_inline_dir(struct file *file,
> >> up_read(&EXT4_I(inode)->xattr_sem);
> >> if (ret < 0)
> >> goto out;
> >> -
> >> + ret = 0;
> >> sb = inode->i_sb;
> >> parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode);
> >> offset = ctx->pos;
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html
> > --
> > Jan Kara <jack@suse.cz>
> > SUSE Labs, CR
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* fix the ext4_read_inline_dir return value
@ 2013-10-21 16:33 Boxi Liu
2013-10-21 17:35 ` jon ernst
2013-10-22 2:10 ` Tao Ma
0 siblings, 2 replies; 9+ messages in thread
From: Boxi Liu @ 2013-10-21 16:33 UTC (permalink / raw)
To: Theodore Tso
Cc: lewis.liulei, linux-ext4@vger.kernel.org, Robin Dong, tm@tao.ma
[-- Attachment #1: Type: text/plain, Size: 340 bytes --]
hi,
there may be a bug in ext4_read_inline_dir() function with inline_data feature.
when I recursion call a sys_old_readdir to read a direntry's
sub_dentry,I find that the ext4_read_inline_dir return the len of the
inline_data ,but in the no inline_data case,it will return 0.It is
inconsistent.
So I try to make a patch to fix it.
[-- Attachment #2: 0001-ext4-fix-the-ext4_read_inline_dir-return-value.patch --]
[-- Type: application/octet-stream, Size: 898 bytes --]
From 0ece067fe8a60566a9c3f636421e280e17277307 Mon Sep 17 00:00:00 2001
From: BoxiLiu <lewis.liulei@huawei.com>
Date: Wed, 18 Sep 2013 01:06:40 +0800
Subject: [PATCH] ext4: fix the ext4_read_inline_dir return value
In ext4_read_inlne_dir,the return value is the return
of ext4_read_inline_data len.But in no inline_data case,
the return value is 0,it's inconsistent.So fix the return
value of ext4_read_inline_dir.
Signed-off-by: BoxiLiu <lewis.liulei@huawei.com>
---
fs/ext4/inline.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index d9ecbf1..c3efb65 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1442,6 +1442,7 @@ int ext4_read_inline_dir(struct file *file,
if (ret < 0)
goto out;
+ ret = 0;
sb = inode->i_sb;
parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode);
offset = ctx->pos;
--
1.8.1.msysgit.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: fix the ext4_read_inline_dir return value
2013-10-21 16:33 Boxi Liu
@ 2013-10-21 17:35 ` jon ernst
2013-10-22 2:10 ` Tao Ma
1 sibling, 0 replies; 9+ messages in thread
From: jon ernst @ 2013-10-21 17:35 UTC (permalink / raw)
To: Boxi Liu; +Cc: linux-ext4@vger.kernel.org List
what's ur point adding "ret = 0;" after "goto out;"
maybe before "goto"?
Best,
On Mon, Oct 21, 2013 at 12:33 PM, Boxi Liu <boxi10liu@gmail.com> wrote:
> hi,
> there may be a bug in ext4_read_inline_dir() function with inline_data feature.
> when I recursion call a sys_old_readdir to read a direntry's
> sub_dentry,I find that the ext4_read_inline_dir return the len of the
> inline_data ,but in the no inline_data case,it will return 0.It is
> inconsistent.
> So I try to make a patch to fix it.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: fix the ext4_read_inline_dir return value
2013-10-21 16:33 Boxi Liu
2013-10-21 17:35 ` jon ernst
@ 2013-10-22 2:10 ` Tao Ma
2013-10-30 12:13 ` Theodore Ts'o
1 sibling, 1 reply; 9+ messages in thread
From: Tao Ma @ 2013-10-22 2:10 UTC (permalink / raw)
To: Boxi Liu; +Cc: Theodore Tso, lewis.liulei, linux-ext4@vger.kernel.org,
Robin Dong
Hi Boxi,
On 10/22/2013 12:33 AM, Boxi Liu wrote:
> hi,
> there may be a bug in ext4_read_inline_dir() function with inline_data feature.
> when I recursion call a sys_old_readdir to read a direntry's
> sub_dentry,I find that the ext4_read_inline_dir return the len of the
> inline_data ,but in the no inline_data case,it will return 0.It is
> inconsistent.
> So I try to make a patch to fix it.
The fix looks good to me an you can add
Acked-by: Tao Ma <boyu.mt@taobao.com>
But next time please generate the patch with git format-patch and send
it using git send-email.
Thanks,
Tao
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: fix the ext4_read_inline_dir return value
2013-10-22 2:10 ` Tao Ma
@ 2013-10-30 12:13 ` Theodore Ts'o
2013-10-31 2:34 ` Tao Ma
0 siblings, 1 reply; 9+ messages in thread
From: Theodore Ts'o @ 2013-10-30 12:13 UTC (permalink / raw)
To: Tao Ma; +Cc: Boxi Liu, lewis.liulei, linux-ext4@vger.kernel.org, Robin Dong
Applied, thanks.
On Tue, Oct 22, 2013 at 10:10:27AM +0800, Tao Ma wrote:
> But next time please generate the patch with git format-patch and send
> it using git send-email.
Yes, please. :-)
I've reworded the commit description a little.
In ext4_read_inline_dir(), if there is inline data, the successful
return value is the return value of ext4_read_inline_data(). Howewer,
this is used by ext4_readdir(), and while it seems harmless to return
a positive value on success, it's inconsistent, since historically
we've always return 0 on success.
BTW, it looks like it would simplify the code a bit to change
ext4_read_inline_page() and ext4_read_line_data() to return 0 on
success, since it looks like the positive value on success isn't
needed anywhere, and this would allow us to remove lines such as this:
return ret >= 0 ? 0 : ret;
as well as the forced ret = 0; in this commit.
Could you take a look and verify that this is true, and I haven't
missed anything?
Also, it would be nice if the functions in fs/ext4/inline.c documented
what the return values are for each of the functions, one way or
another.
Thanks!!
- Ted
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: fix the ext4_read_inline_dir return value
2013-10-30 12:13 ` Theodore Ts'o
@ 2013-10-31 2:34 ` Tao Ma
0 siblings, 0 replies; 9+ messages in thread
From: Tao Ma @ 2013-10-31 2:34 UTC (permalink / raw)
To: Theodore Ts'o
Cc: Boxi Liu, lewis.liulei, linux-ext4@vger.kernel.org, Robin Dong
On 10/30/2013 08:13 PM, Theodore Ts'o wrote:
> Applied, thanks.
>
> On Tue, Oct 22, 2013 at 10:10:27AM +0800, Tao Ma wrote:
>> But next time please generate the patch with git format-patch and send
>> it using git send-email.
>
> Yes, please. :-)
>
> I've reworded the commit description a little.
>
> In ext4_read_inline_dir(), if there is inline data, the successful
> return value is the return value of ext4_read_inline_data(). Howewer,
> this is used by ext4_readdir(), and while it seems harmless to return
> a positive value on success, it's inconsistent, since historically
> we've always return 0 on success.
>
>
> BTW, it looks like it would simplify the code a bit to change
> ext4_read_inline_page() and ext4_read_line_data() to return 0 on
> success, since it looks like the positive value on success isn't
> needed anywhere, and this would allow us to remove lines such as this:
>
> return ret >= 0 ? 0 : ret;
>
> as well as the forced ret = 0; in this commit.
>
> Could you take a look and verify that this is true, and I haven't
> missed anything?
sure, I will look into it.
>
> Also, it would be nice if the functions in fs/ext4/inline.c documented
> what the return values are for each of the functions, one way or
> another.
OK, I will try to generate a patch for it.
Thanks,
Tao
>
> Thanks!!
>
> - Ted
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-10-31 2:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17 15:08 fix the ext4_read_inline_dir return value Boxi Liu
2013-09-17 16:29 ` Jan Kara
2013-09-17 17:30 ` Boxi Liu
2013-09-17 17:38 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2013-10-21 16:33 Boxi Liu
2013-10-21 17:35 ` jon ernst
2013-10-22 2:10 ` Tao Ma
2013-10-30 12:13 ` Theodore Ts'o
2013-10-31 2:34 ` Tao Ma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).