linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Eric Biggers <ebiggers@kernel.org>,
	"Theodore Y. Ts'o" <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Daniel Rosenberg <drosen@google.com>,
	Chao Yu <yuchao0@huawei.com>
Subject: linux-next: manual merge of the fsverity tree with the f2fs tree
Date: Wed, 31 Jul 2019 10:47:48 +1000	[thread overview]
Message-ID: <20190731104748.203bf67b@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 5586 bytes --]

Hi all,

Today's linux-next merge of the fsverity tree got conflicts in:

  fs/f2fs/file.c
  fs/f2fs/inode.c

between commits:

  cf3dbe1481d1 ("f2fs: support FS_IOC_{GET,SET}FSLABEL")
  01ff2b3740a6 ("f2fs: Support case-insensitive file name lookups")

from the f2fs tree and commit:

  60d7bf0f790f ("f2fs: add fs-verity support")

from the fsverity 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 eb1aa9b75eda,838bfeecbd86..000000000000
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@@ -1721,7 -1721,7 +1729,8 @@@ static const struct 
  		FS_ENCRYPT_FL |		\
  		FS_INLINE_DATA_FL |	\
  		FS_NOCOW_FL |		\
- 		FS_CASEFOLD_FL)
++		FS_CASEFOLD_FL |	\
+ 		FS_VERITY_FL)
  
  #define F2FS_SETTABLE_FS_FL (		\
  		FS_SYNC_FL |		\
@@@ -3080,86 -3088,34 +3091,110 @@@ static int f2fs_ioc_resize_fs(struct fi
  	return ret;
  }
  
 +static int f2fs_get_volume_name(struct file *filp, unsigned long arg)
 +{
 +	struct inode *inode = file_inode(filp);
 +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 +	char *vbuf;
 +	int count;
 +	int err = 0;
 +
 +	vbuf = f2fs_kzalloc(sbi, MAX_VOLUME_NAME, GFP_KERNEL);
 +	if (!vbuf)
 +		return -ENOMEM;
 +
 +	down_read(&sbi->sb_lock);
 +	count = utf16s_to_utf8s(sbi->raw_super->volume_name,
 +			sizeof(sbi->raw_super->volume_name),
 +			UTF16_LITTLE_ENDIAN, vbuf, MAX_VOLUME_NAME);
 +	up_read(&sbi->sb_lock);
 +
 +	if (copy_to_user((char __user *)arg, vbuf,
 +				min(FSLABEL_MAX, count)))
 +		err = -EFAULT;
 +
 +	kvfree(vbuf);
 +	return err;
 +}
 +
 +static int f2fs_set_volume_name(struct file *filp, unsigned long arg)
 +{
 +	struct inode *inode = file_inode(filp);
 +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 +	char *vbuf;
 +	int len;
 +	int err = 0;
 +
 +	vbuf = f2fs_kzalloc(sbi, MAX_VOLUME_NAME, GFP_KERNEL);
 +	if (!vbuf)
 +		return -ENOMEM;
 +
 +	if (copy_from_user(vbuf, (char __user *)arg, FSLABEL_MAX)) {
 +		err = -EFAULT;
 +		goto out;
 +	}
 +
 +	len = strnlen(vbuf, FSLABEL_MAX);
 +	if (len > FSLABEL_MAX - 1) {
 +		err = -EINVAL;
 +		goto out;
 +	}
 +
 +	err = mnt_want_write_file(filp);
 +	if (err)
 +		goto out;
 +
 +	down_write(&sbi->sb_lock);
 +
 +	memset(sbi->raw_super->volume_name, 0,
 +			sizeof(sbi->raw_super->volume_name));
 +	utf8s_to_utf16s(vbuf, MAX_VOLUME_NAME, UTF16_LITTLE_ENDIAN,
 +			sbi->raw_super->volume_name,
 +			sizeof(sbi->raw_super->volume_name));
 +
 +	err = f2fs_commit_super(sbi, false);
 +
 +	up_write(&sbi->sb_lock);
 +
 +	mnt_drop_write_file(filp);
 +out:
 +	kvfree(vbuf);
 +	return err;
 +}
 +
+ static int f2fs_ioc_enable_verity(struct file *filp, unsigned long arg)
+ {
+ 	struct inode *inode = file_inode(filp);
+ 
+ 	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
+ 
+ 	if (!f2fs_sb_has_verity(F2FS_I_SB(inode))) {
+ 		f2fs_warn(F2FS_I_SB(inode),
+ 			  "Can't enable fs-verity on inode %lu: the verity feature is not enabled on this filesystem.\n",
+ 			  inode->i_ino);
+ 		return -EOPNOTSUPP;
+ 	}
+ 
+ 	return fsverity_ioctl_enable(filp, (const void __user *)arg);
+ }
+ 
+ static int f2fs_ioc_measure_verity(struct file *filp, unsigned long arg)
+ {
+ 	if (!f2fs_sb_has_verity(F2FS_I_SB(file_inode(filp))))
+ 		return -EOPNOTSUPP;
+ 
+ 	return fsverity_ioctl_measure(filp, (void __user *)arg);
+ }
+ 
  long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
  {
 +	int ret;
 +
  	if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp)))))
  		return -EIO;
 +	ret = f2fs_is_checkpoint_ready(F2FS_I_SB(file_inode(filp)));
 +	if (ret)
 +		return ret;
  
  	switch (cmd) {
  	case F2FS_IOC_GETFLAGS:
@@@ -3214,10 -3170,10 +3249,14 @@@
  		return f2fs_ioc_precache_extents(filp, arg);
  	case F2FS_IOC_RESIZE_FS:
  		return f2fs_ioc_resize_fs(filp, arg);
 +	case F2FS_IOC_GET_VOLUME_NAME:
 +		return f2fs_get_volume_name(filp, arg);
 +	case F2FS_IOC_SET_VOLUME_NAME:
 +		return f2fs_set_volume_name(filp, arg);
+ 	case FS_IOC_ENABLE_VERITY:
+ 		return f2fs_ioc_enable_verity(filp, arg);
+ 	case FS_IOC_MEASURE_VERITY:
+ 		return f2fs_ioc_measure_verity(filp, arg);
  	default:
  		return -ENOTTY;
  	}
@@@ -3332,8 -3288,8 +3371,10 @@@ long f2fs_compat_ioctl(struct file *fil
  	case F2FS_IOC_SET_PIN_FILE:
  	case F2FS_IOC_PRECACHE_EXTENTS:
  	case F2FS_IOC_RESIZE_FS:
 +	case F2FS_IOC_GET_VOLUME_NAME:
 +	case F2FS_IOC_SET_VOLUME_NAME:
+ 	case FS_IOC_ENABLE_VERITY:
+ 	case FS_IOC_MEASURE_VERITY:
  		break;
  	default:
  		return -ENOIOCTLCMD;
diff --cc fs/f2fs/inode.c
index 5d78f2db7a67,06da75d418e0..000000000000
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@@ -46,11 -46,11 +46,13 @@@ void f2fs_set_inode_flags(struct inode 
  		new_fl |= S_DIRSYNC;
  	if (file_is_encrypt(inode))
  		new_fl |= S_ENCRYPTED;
 +	if (flags & F2FS_CASEFOLD_FL)
 +		new_fl |= S_CASEFOLD;
+ 	if (file_is_verity(inode))
+ 		new_fl |= S_VERITY;
  	inode_set_flags(inode, new_fl,
  			S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|
- 			S_ENCRYPTED|S_CASEFOLD);
 -			S_ENCRYPTED|S_VERITY);
++			S_ENCRYPTED|S_CASEFOLD|S_VERITY);
  }
  
  static void __get_inode_rdev(struct inode *inode, struct f2fs_inode *ri)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2019-07-31  0:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31  0:47 Stephen Rothwell [this message]
2019-08-19  0:41 linux-next: manual merge of the fsverity tree with the f2fs tree Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190731104748.203bf67b@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=drosen@google.com \
    --cc=ebiggers@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).