2013-09-17 15:08:51

by Boxi Liu

[permalink] [raw]
Subject: fix the ext4_read_inline_dir return value

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;


2013-09-17 16:29:24

by Jan Kara

[permalink] [raw]
Subject: Re: fix the ext4_read_inline_dir return value

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 [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Jan Kara <[email protected]>
SUSE Labs, CR

2013-09-17 17:30:36

by Boxi Liu

[permalink] [raw]
Subject: Re: fix the ext4_read_inline_dir return value

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 <[email protected]>
---
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 <[email protected]>:
> 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 [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> Jan Kara <[email protected]>
> SUSE Labs, CR

2013-09-17 17:38:34

by Jan Kara

[permalink] [raw]
Subject: Re: fix the ext4_read_inline_dir return value

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 <[email protected]>
> ---
> 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 <[email protected]>:
> > 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 [email protected]
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html
> > --
> > Jan Kara <[email protected]>
> > SUSE Labs, CR
--
Jan Kara <[email protected]>
SUSE Labs, CR