Subject: linux-next: manual merge of the ext4 tree with Linus' tree

From: Mark Brown <[email-masked]>
Date: Thu, 19 Sep 2019 12:44:17 +0100

Hi all,

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

  fs/ext4/ioctl.c

between commit:

  29b3692e6dbf8226 ("ext4: wire up new fscrypt ioctls")

from Linus' tree and commits:

  bb5835edcdf8bf7 ("ext4: add new ioctl EXT4_IOC_GET_ES_CACHE")
  1ad3ea6e0a694b0 ("ext4: add a new ioctl EXT4_IOC_GETSTATE")

from the ext4 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.

diff --cc fs/ext4/ioctl.c
index 5444d49cbf09d,d6242b7b87182..0000000000000
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@@ -1113,35 -1181,35 +1181,62 @@@ resizefs_out
  #endif
  	}
  	case EXT4_IOC_GET_ENCRYPTION_POLICY:
 +		if (!ext4_has_feature_encrypt(sb))
 +			return -EOPNOTSUPP;
  		return fscrypt_ioctl_get_policy(filp, (void __user *)arg);
  
 +	case FS_IOC_GET_ENCRYPTION_POLICY_EX:
 +		if (!ext4_has_feature_encrypt(sb))
 +			return -EOPNOTSUPP;
 +		return fscrypt_ioctl_get_policy_ex(filp, (void __user *)arg);
 +
 +	case FS_IOC_ADD_ENCRYPTION_KEY:
 +		if (!ext4_has_feature_encrypt(sb))
 +			return -EOPNOTSUPP;
 +		return fscrypt_ioctl_add_key(filp, (void __user *)arg);
 +
 +	case FS_IOC_REMOVE_ENCRYPTION_KEY:
 +		if (!ext4_has_feature_encrypt(sb))
 +			return -EOPNOTSUPP;
 +		return fscrypt_ioctl_remove_key(filp, (void __user *)arg);
 +
 +	case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
 +		if (!ext4_has_feature_encrypt(sb))
 +			return -EOPNOTSUPP;
 +		return fscrypt_ioctl_remove_key_all_users(filp,
 +							  (void __user *)arg);
 +	case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
 +		if (!ext4_has_feature_encrypt(sb))
 +			return -EOPNOTSUPP;
 +		return fscrypt_ioctl_get_key_status(filp, (void __user *)arg);
 +
+ 	case EXT4_IOC_CLEAR_ES_CACHE:
+ 	{
+ 		if (!inode_owner_or_capable(inode))
+ 			return -EACCES;
+ 		ext4_clear_inode_es(inode);
+ 		return 0;
+ 	}
+ 
+ 	case EXT4_IOC_GETSTATE:
+ 	{
+ 		__u32	state = 0;
+ 
+ 		if (ext4_test_inode_state(inode, EXT4_STATE_EXT_PRECACHED))
+ 			state |= EXT4_STATE_FLAG_EXT_PRECACHED;
+ 		if (ext4_test_inode_state(inode, EXT4_STATE_NEW))
+ 			state |= EXT4_STATE_FLAG_NEW;
+ 		if (ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY))
+ 			state |= EXT4_STATE_FLAG_NEWENTRY;
+ 		if (ext4_test_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE))
+ 			state |= EXT4_STATE_FLAG_DA_ALLOC_CLOSE;
+ 
+ 		return put_user(state, (__u32 __user *) arg);
+ 	}
+ 
+ 	case EXT4_IOC_GET_ES_CACHE:
+ 		return ext4_ioctl_get_es_cache(filp, arg);
+ 
  	case EXT4_IOC_FSGETXATTR:
  	{
  		struct fsxattr fa;
@@@ -1269,15 -1326,11 +1364,18 @@@ long ext4_compat_ioctl(struct file *fil
  	case EXT4_IOC_SET_ENCRYPTION_POLICY:
  	case EXT4_IOC_GET_ENCRYPTION_PWSALT:
  	case EXT4_IOC_GET_ENCRYPTION_POLICY:
 +	case FS_IOC_GET_ENCRYPTION_POLICY_EX:
 +	case FS_IOC_ADD_ENCRYPTION_KEY:
 +	case FS_IOC_REMOVE_ENCRYPTION_KEY:
 +	case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
 +	case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
  	case EXT4_IOC_SHUTDOWN:
  	case FS_IOC_GETFSMAP:
 +	case FS_IOC_ENABLE_VERITY:
 +	case FS_IOC_MEASURE_VERITY:
+ 	case EXT4_IOC_CLEAR_ES_CACHE:
+ 	case EXT4_IOC_GETSTATE:
+ 	case EXT4_IOC_GET_ES_CACHE:
  		break;
  	default:
  		return -ENOIOCTLCMD;