linux-next: manual merge of the f2fs tree with the vfs-idmapping tree

From: Stephen Rothwell
Date: Mon Jan 30 2023 - 18:10:13 EST


Hi all,

Today's linux-next merge of the f2fs tree got a conflict in:

fs/f2fs/file.c

between commit:

f2d40141d5d9 ("fs: port inode_init_owner() to mnt_idmap")

from the vfs-idmapping tree and commit:

81712a1f56dc ("f2fs: synchronize atomic write aborts")

from the f2fs tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/file.c
index b90617639743,3efb0852fd48..000000000000
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@@ -2087,19 -2090,28 +2090,28 @@@ static int f2fs_ioc_start_atomic_write(
goto out;
}

- /* 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;
- }
+ /* 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;
+ }

- ret = f2fs_get_tmpfile(idmap, pinode, &fi->cow_inode);
- iput(pinode);
- if (ret) {
- f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
- goto out;
- ret = f2fs_get_tmpfile(mnt_userns, pinode, &fi->cow_inode);
++ ret = f2fs_get_tmpfile(idmap, pinode, &fi->cow_inode);
+ iput(pinode);
+ if (ret) {
+ f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
+ goto out;
+ }
+
+ set_inode_flag(fi->cow_inode, FI_COW_FILE);
+ clear_inode_flag(fi->cow_inode, FI_INLINE_DATA);
+ } else {
+ /* Reuse the already created COW inode */
+ f2fs_do_truncate_blocks(fi->cow_inode, 0, true);
}

f2fs_write_inode(inode, NULL);

Attachment: pgpEybkLWs97k.pgp
Description: OpenPGP digital signature