Skip to contentSkip to conversation

f2fs: return proper error code

PATCH In review Tiezhu Yang 2 participants 3 messages Jul 10, 2016 – Jul 13, 2016 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: return proper error code

When the length of file name is more than F2FS_NAME_LEN, it should return -ENAMETOOLONG.

---
 fs/f2fs/xattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/xattr.c +2 -2
index 28a5023..b225062 100644
@@ -364,7 +364,7 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
 
 	len = strlen(name);
 	if (len > F2FS_NAME_LEN)
-		return -ERANGE;
+		return -ENAMETOOLONG;
 
 	base_addr = read_all_xattrs(inode, ipage);
 	if (!base_addr)
@@ -458,7 +458,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;
Signature · 7 lines
1.8.3.1
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
#1 lore raw
Quoted 1 line · Tiezhu Yang

When the length of file name is more than F2FS_NAME_LEN,

Seem @name indicates a xattr/key name, not a file name.

Thanks,

Quoted 22 lines

it should return -ENAMETOOLONG.

---
 fs/f2fs/xattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/xattr.c +1 -1
index 28a5023..b225062 100644
@@ -364,7 +364,7 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
 
 	len = strlen(name);
 	if (len > F2FS_NAME_LEN)
-		return -ERANGE;
+		return -ENAMETOOLONG;
 
 	base_addr = read_all_xattrs(inode, ipage);
 	if (!base_addr)

fs/f2fs/xattr.c static int __f2fs_setxattr(struct inode *inode, int index, · line 464

Quoted 8 lines
fs/f2fs/xattr.c +1 -1
@@ -458,7 +458,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;

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev

#2 lore raw
Quoted 4 lines · Chao Yu
Quoted 1 line · Tiezhu Yang

When the length of file name is more than F2FS_NAME_LEN,

Seem @name indicates a xattr/key name, not a file name.

Yes, you are right. Sorry for the noise.

Thanks,