Skip to contentSkip to conversation

f2fs: fix the fault of checking F2FS_LINK_MAX for rename inode

PATCH In review Kinglong Mee 2 participants 2 messages Mar 4, 2017 – Mar 6, 2017 1 message not in the archive F2FS file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 f2fs: fix the fault of checking F2FS_LINK_MAX for rename inode

The parent directory's nlink will change, not the inode.

---
 fs/f2fs/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/namei.c +2 -2
index 0eda022..3231a0a 100644
@@ -908,8 +908,8 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 		old_nlink = old_dir_entry ? -1 : 1;
 		new_nlink = -old_nlink;
 		err = -EMLINK;
-		if ((old_nlink > 0 && old_inode->i_nlink >= F2FS_LINK_MAX) ||
-			(new_nlink > 0 && new_inode->i_nlink >= F2FS_LINK_MAX))
+		if ((old_nlink > 0 && old_dir->i_nlink >= F2FS_LINK_MAX) ||
+			(new_nlink > 0 && new_dir->i_nlink >= F2FS_LINK_MAX))
 			goto out_new_dir;
 	}
 
Signature · 6 lines
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Reviewed-by on v1 1/2
#2 lore raw
Quoted 3 lines · Kinglong Mee

The parent directory's nlink will change, not the inode.

Thanks,

Quoted 10 lines
---
 fs/f2fs/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/namei.c +0 -0
index 0eda022..3231a0a 100644

fs/f2fs/namei.c static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, · line 915

Quoted 10 lines
fs/f2fs/namei.c +2 -2
@@ -908,8 +908,8 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 		old_nlink = old_dir_entry ? -1 : 1;
 		new_nlink = -old_nlink;
 		err = -EMLINK;
-		if ((old_nlink > 0 && old_inode->i_nlink >= F2FS_LINK_MAX) ||
-			(new_nlink > 0 && new_inode->i_nlink >= F2FS_LINK_MAX))
+		if ((old_nlink > 0 && old_dir->i_nlink >= F2FS_LINK_MAX) ||
+			(new_nlink > 0 && new_dir->i_nlink >= F2FS_LINK_MAX))
 			goto out_new_dir;
 	}
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot