All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: replace ERANGE with ENAMETOOLONG in file name length check
@ 2021-06-15  1:35 Wang Xiaojun
  2021-06-15  2:31 ` Gao Xiang
  0 siblings, 1 reply; 5+ messages in thread
From: Wang Xiaojun @ 2021-06-15  1:35 UTC (permalink / raw)
  To: yuchao0, jaegeuk; +Cc: linux-f2fs-devel

ERANGE indicates that the math result is not representative. Here,
ENAMETOOLONG is used to replace ERANGE.

Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
---
 fs/f2fs/xattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index c8f34decbf8e..eb827c10e970 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -529,7 +529,7 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
 
 	len = strlen(name);
 	if (len > F2FS_NAME_LEN)
-		return -ERANGE;
+		return -ENAMETOOLONG;
 
 	down_read(&F2FS_I(inode)->i_xattr_sem);
 	error = lookup_all_xattrs(inode, ipage, index, len, name,
@@ -646,7 +646,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
 	len = strlen(name);
 
 	if (len > F2FS_NAME_LEN)
-		return -ERANGE;
+		return -ENAMETOOLONG;
 
 	if (size > MAX_VALUE_LEN(inode))
 		return -E2BIG;
-- 
2.25.4



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: replace ERANGE with ENAMETOOLONG in file name length check
  2021-06-15  1:35 [f2fs-dev] [PATCH] f2fs: replace ERANGE with ENAMETOOLONG in file name length check Wang Xiaojun
@ 2021-06-15  2:31 ` Gao Xiang
  2021-06-15  3:19   ` wangxiaojun (N)
  2021-06-16 13:21   ` Chao Yu
  0 siblings, 2 replies; 5+ messages in thread
From: Gao Xiang @ 2021-06-15  2:31 UTC (permalink / raw)
  To: Wang Xiaojun; +Cc: jaegeuk, linux-f2fs-devel

On Tue, Jun 15, 2021 at 09:35:09AM +0800, Wang Xiaojun wrote:
> ERANGE indicates that the math result is not representative. Here,
> ENAMETOOLONG is used to replace ERANGE.
> 
> Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>

I don't think ENAMETOOLONG is a valid return code for {g,s}etxattr.
https://man7.org/linux/man-pages/man2/getxattr.2.html
https://man7.org/linux/man-pages/man2/setxattr.2.html
instead of ERANGE.

please also see ext4 / xfs implementations.

Thanks,
Gao Xiang


> ---
>  fs/f2fs/xattr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> index c8f34decbf8e..eb827c10e970 100644
> --- a/fs/f2fs/xattr.c
> +++ b/fs/f2fs/xattr.c
> @@ -529,7 +529,7 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
>  
>  	len = strlen(name);
>  	if (len > F2FS_NAME_LEN)
> -		return -ERANGE;
> +		return -ENAMETOOLONG;
>  
>  	down_read(&F2FS_I(inode)->i_xattr_sem);
>  	error = lookup_all_xattrs(inode, ipage, index, len, name,
> @@ -646,7 +646,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
>  	len = strlen(name);
>  
>  	if (len > F2FS_NAME_LEN)
> -		return -ERANGE;
> +		return -ENAMETOOLONG;
>  
>  	if (size > MAX_VALUE_LEN(inode))
>  		return -E2BIG;
> -- 
> 2.25.4
> 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: replace ERANGE with ENAMETOOLONG in file name length check
  2021-06-15  2:31 ` Gao Xiang
@ 2021-06-15  3:19   ` wangxiaojun (N)
  2021-06-15  3:44     ` Gao Xiang
  2021-06-16 13:21   ` Chao Yu
  1 sibling, 1 reply; 5+ messages in thread
From: wangxiaojun (N) @ 2021-06-15  3:19 UTC (permalink / raw)
  To: Gao Xiang; +Cc: jaegeuk, linux-f2fs-devel


在 2021/6/15 10:31, Gao Xiang 写道:
> On Tue, Jun 15, 2021 at 09:35:09AM +0800, Wang Xiaojun wrote:
>> ERANGE indicates that the math result is not representative. Here,
>> ENAMETOOLONG is used to replace ERANGE.
>>
>> Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
> I don't think ENAMETOOLONG is a valid return code for {g,s}etxattr.
> https://man7.org/linux/man-pages/man2/getxattr.2.html
> https://man7.org/linux/man-pages/man2/setxattr.2.html
> instead of ERANGE.
>
> please also see ext4 / xfs implementations.
>
> Thanks,
> Gao Xiang

Hi Xiang, You're right. Thanks for your comments.

>
>> ---
>>   fs/f2fs/xattr.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
>> index c8f34decbf8e..eb827c10e970 100644
>> --- a/fs/f2fs/xattr.c
>> +++ b/fs/f2fs/xattr.c
>> @@ -529,7 +529,7 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
>>   
>>   	len = strlen(name);
>>   	if (len > F2FS_NAME_LEN)
>> -		return -ERANGE;
>> +		return -ENAMETOOLONG;
>>   
>>   	down_read(&F2FS_I(inode)->i_xattr_sem);
>>   	error = lookup_all_xattrs(inode, ipage, index, len, name,
>> @@ -646,7 +646,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
>>   	len = strlen(name);
>>   
>>   	if (len > F2FS_NAME_LEN)
>> -		return -ERANGE;
>> +		return -ENAMETOOLONG;
>>   
>>   	if (size > MAX_VALUE_LEN(inode))
>>   		return -E2BIG;
>> -- 
>> 2.25.4
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: replace ERANGE with ENAMETOOLONG in file name length check
  2021-06-15  3:19   ` wangxiaojun (N)
@ 2021-06-15  3:44     ` Gao Xiang
  0 siblings, 0 replies; 5+ messages in thread
From: Gao Xiang @ 2021-06-15  3:44 UTC (permalink / raw)
  To: wangxiaojun (N); +Cc: jaegeuk, linux-f2fs-devel



On Tue, Jun 15, 2021 at 11:19:24AM +0800, wangxiaojun (N) wrote:
> 
> 在 2021/6/15 10:31, Gao Xiang 写道:
> > On Tue, Jun 15, 2021 at 09:35:09AM +0800, Wang Xiaojun wrote:
> > > ERANGE indicates that the math result is not representative. Here,
> > > ENAMETOOLONG is used to replace ERANGE.
> > > 
> > > Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
> > I don't think ENAMETOOLONG is a valid return code for {g,s}etxattr.
> > https://man7.org/linux/man-pages/man2/getxattr.2.html
> > https://man7.org/linux/man-pages/man2/setxattr.2.html
> > instead of ERANGE.
> > 
> > please also see ext4 / xfs implementations.
> > 
> > Thanks,
> > Gao Xiang
> 
> Hi Xiang, You're right. Thanks for your comments.

Hi Xiaojun,

Yeah, currently ENAMETOOLONG is strictly specific for pathname. If we
change like this, I'm not sure if it could break some exist user
programs.

IOW, it should be a wide discussion or modification at least.

Thanks,
Gao Xiang

> 
> > 
> > > ---
> > >   fs/f2fs/xattr.c | 4 ++--
> > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> > > index c8f34decbf8e..eb827c10e970 100644
> > > --- a/fs/f2fs/xattr.c
> > > +++ b/fs/f2fs/xattr.c
> > > @@ -529,7 +529,7 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
> > >   	len = strlen(name);
> > >   	if (len > F2FS_NAME_LEN)
> > > -		return -ERANGE;
> > > +		return -ENAMETOOLONG;
> > >   	down_read(&F2FS_I(inode)->i_xattr_sem);
> > >   	error = lookup_all_xattrs(inode, ipage, index, len, name,
> > > @@ -646,7 +646,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
> > >   	len = strlen(name);
> > >   	if (len > F2FS_NAME_LEN)
> > > -		return -ERANGE;
> > > +		return -ENAMETOOLONG;
> > >   	if (size > MAX_VALUE_LEN(inode))
> > >   		return -E2BIG;
> > > -- 
> > > 2.25.4
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > Linux-f2fs-devel mailing list
> > > Linux-f2fs-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> > .


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: replace ERANGE with ENAMETOOLONG in file name length check
  2021-06-15  2:31 ` Gao Xiang
  2021-06-15  3:19   ` wangxiaojun (N)
@ 2021-06-16 13:21   ` Chao Yu
  1 sibling, 0 replies; 5+ messages in thread
From: Chao Yu @ 2021-06-16 13:21 UTC (permalink / raw)
  To: Gao Xiang, Wang Xiaojun; +Cc: jaegeuk, linux-f2fs-devel

On 2021/6/15 10:31, Gao Xiang wrote:
> On Tue, Jun 15, 2021 at 09:35:09AM +0800, Wang Xiaojun wrote:
>> ERANGE indicates that the math result is not representative. Here,
>> ENAMETOOLONG is used to replace ERANGE.
>>
>> Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
> 
> I don't think ENAMETOOLONG is a valid return code for {g,s}etxattr.
> https://man7.org/linux/man-pages/man2/getxattr.2.html
> https://man7.org/linux/man-pages/man2/setxattr.2.html
> instead of ERANGE.

Agreed, it should implement according to man of {g,s}etxattr.

Thanks,

> 
> please also see ext4 / xfs implementations.
> 
> Thanks,
> Gao Xiang
> 
> 
>> ---
>>   fs/f2fs/xattr.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
>> index c8f34decbf8e..eb827c10e970 100644
>> --- a/fs/f2fs/xattr.c
>> +++ b/fs/f2fs/xattr.c
>> @@ -529,7 +529,7 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
>>   
>>   	len = strlen(name);
>>   	if (len > F2FS_NAME_LEN)
>> -		return -ERANGE;
>> +		return -ENAMETOOLONG;
>>   
>>   	down_read(&F2FS_I(inode)->i_xattr_sem);
>>   	error = lookup_all_xattrs(inode, ipage, index, len, name,
>> @@ -646,7 +646,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
>>   	len = strlen(name);
>>   
>>   	if (len > F2FS_NAME_LEN)
>> -		return -ERANGE;
>> +		return -ENAMETOOLONG;
>>   
>>   	if (size > MAX_VALUE_LEN(inode))
>>   		return -E2BIG;
>> -- 
>> 2.25.4
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-16 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15  1:35 [f2fs-dev] [PATCH] f2fs: replace ERANGE with ENAMETOOLONG in file name length check Wang Xiaojun
2021-06-15  2:31 ` Gao Xiang
2021-06-15  3:19   ` wangxiaojun (N)
2021-06-15  3:44     ` Gao Xiang
2021-06-16 13:21   ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.