Patch "f2fs: Create COW inode from parent dentry for atomic write" has been added to the 6.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    f2fs: Create COW inode from parent dentry for atomic write

to the 6.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     f2fs-create-cow-inode-from-parent-dentry-for-atomic-.patch
and it can be found in the queue-6.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0e1bf4b63004edfc1c8f41e63db5059f35b2ff45
Author: Yeongjin Gil <youngjin.gil@xxxxxxxxxxx>
Date:   Tue Aug 13 16:32:44 2024 +0900

    f2fs: Create COW inode from parent dentry for atomic write
    
    [ Upstream commit 8c1b787938fd86bab27a1492fa887408c75fec2b ]
    
    The i_pino in f2fs_inode_info has the previous parent's i_ino when inode
    was renamed, which may cause f2fs_ioc_start_atomic_write to fail.
    If file_wrong_pino is true and i_nlink is 1, then to find a valid pino,
    we should refer to the dentry from inode.
    
    To resolve this issue, let's get parent inode using parent dentry
    directly.
    
    Fixes: 3db1de0e582c ("f2fs: change the current atomic write way")
    Reviewed-by: Sungjong Seo <sj1557.seo@xxxxxxxxxxx>
    Reviewed-by: Sunmin Jeong <s_min.jeong@xxxxxxxxxxx>
    Signed-off-by: Yeongjin Gil <youngjin.gil@xxxxxxxxxxx>
    Reviewed-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
    Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
    Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index afa43d1aa030a..bf448dbe2c551 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2119,7 +2119,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate)
 	struct mnt_idmap *idmap = file_mnt_idmap(filp);
 	struct f2fs_inode_info *fi = F2FS_I(inode);
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
-	struct inode *pinode;
 	loff_t isize;
 	int ret;
 
@@ -2169,15 +2168,10 @@ static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate)
 	/* Check if the inode already has a COW inode */
 	if (fi->cow_inode == NULL) {
 		/* Create a COW inode for atomic write */
-		pinode = f2fs_iget(inode->i_sb, fi->i_pino);
-		if (IS_ERR(pinode)) {
-			f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
-			ret = PTR_ERR(pinode);
-			goto out;
-		}
+		struct dentry *dentry = file_dentry(filp);
+		struct inode *dir = d_inode(dentry->d_parent);
 
-		ret = f2fs_get_tmpfile(idmap, pinode, &fi->cow_inode);
-		iput(pinode);
+		ret = f2fs_get_tmpfile(idmap, dir, &fi->cow_inode);
 		if (ret) {
 			f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
 			goto out;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux