Subject: linux-next: manual merge of the vfs tree with the overlayfs tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 29 May 2018 11:30:35 +1000

Hi all,

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

  fs/read_write.c

between commit:

  63ea46a359b2 ("vfs: dedupe: extract helper for a single dedup")

from the overlayfs tree and commit:

  227627114799 ("fs: avoid fdput() after failed fdget() in vfs_dedupe_file_range()")

from the vfs tree.

I can't see how to easily fix up this conflict, so I effectively dropped
the vfs tree change.

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/read_write.c
index 4d61375a0de4,e83bd9744b5d..000000000000
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@@ -2055,21 -2021,46 +2055,20 @@@ int vfs_dedupe_file_range(struct file *
  
  		if (info->reserved) {
  			info->status = -EINVAL;
 -		} else if (!(is_admin || (dst_file->f_mode & FMODE_WRITE))) {
 -			info->status = -EINVAL;
 -		} else if (file->f_path.mnt != dst_file->f_path.mnt) {
 -			info->status = -EXDEV;
 -		} else if (S_ISDIR(dst->i_mode)) {
 -			info->status = -EISDIR;
 -		} else if (dst_file->f_op->dedupe_file_range == NULL) {
 -			info->status = -EINVAL;
 -		} else {
 -			deduped = dst_file->f_op->dedupe_file_range(file, off,
 -							len, dst_file,
 -							info->dest_offset);
 -			if (deduped == -EBADE)
 -				info->status = FILE_DEDUPE_RANGE_DIFFERS;
 -			else if (deduped < 0)
 -				info->status = deduped;
 -			else
 -				info->bytes_deduped += deduped;
 +			goto next_loop;
  		}
  
 -next_file:
 -		mnt_drop_write_file(dst_file);
 -next_fdput:
 -		fdput(dst_fd);
 +		deduped = vfs_dedupe_file_range_one(file, off, dst_file,
 +						    info->dest_offset, len);
 +		if (deduped == -EBADE)
 +			info->status = FILE_DEDUPE_RANGE_DIFFERS;
 +		else if (deduped < 0)
 +			info->status = deduped;
 +		else
 +			info->bytes_deduped += deduped;
 +
  next_loop:
 +		fdput(dst_fd);
- 
  		if (fatal_signal_pending(current))
  			goto out;
  	}