linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Al Viro <viro@ZenIV.linux.org.uk>, David Sterba <dsterba@suse.cz>
Cc: Linux-Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Subject: linux-next: manual merge of the vfs tree with the btrfs-kdave tree
Date: Thu, 9 Nov 2017 09:47:17 +1100	[thread overview]
Message-ID: <20171109094717.011fe53a@canb.auug.org.au> (raw)

Hi Al,

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

  fs/btrfs/super.c

between commit:

  c2a6acf1b800 ("btrfs: cleanup btrfs_mount() using mount_root()")

from the btrfs-kdave tree and commit:

  c2c6773f9942 ("VFS: Roll out mount flag differentiation (MS_* -> SB_*) generally")

from the vfs 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/btrfs/super.c
index 254e7422a69e,e56a93f3113e..000000000000
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@@ -1530,9 -1543,11 +1530,9 @@@ static struct dentry *mount_root(struc
  	struct btrfs_fs_info *fs_info = NULL;
  	struct security_mnt_opts new_sec_opts;
  	fmode_t mode = FMODE_READ;
 -	char *subvol_name = NULL;
 -	u64 subvol_objectid = 0;
  	int error = 0;
  
- 	if (!(flags & MS_RDONLY))
+ 	if (!(flags & SB_RDONLY))
  		mode |= FMODE_WRITE;
  
  	error = btrfs_parse_early_options(data, mode, fs_type,
@@@ -1624,84 -1647,6 +1624,84 @@@ error_sec_opts
  	return ERR_PTR(error);
  }
  
 +/*
 + * Mount function which is called by VFS layer.
 + *
 + * In order to allow mounting a subvolume directly, btrfs uses
 + * mount_subtree() which needs vfsmount* of device's root (/).
 + * This means device's root has to be mounted internally in any case.
 + *
 + * Operation flow:
 + *   1. Parse subvol id related options for later use in mount_subvol().
 + *
 + *   2. Mount device's root (/) by calling vfs_kern_mount().
 + *
 + *      NOTE: vfs_kern_mount() is used by VFS to call btrfs_mount() in the
 + *      first place. In order to avoid calling btrfs_mount() again, we use
 + *      different file_system_type which is not registered to VFS by
 + *      register_filesystem(). As a result, mount_root() is called.
 + *      The return value will be used by mount_subtree() in mount_subvol().
 + *
 + *   3. Call mount_subvol() to get the dentry of subvolume. Since there is
 + *      "btrfs subvolume set-default", mount_subvol() is called always.
 + */
 +static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
 +		const char *device_name, void *data)
 +{
 +	struct vfsmount *mnt_root;
 +	struct dentry *root;
 +	fmode_t mode = FMODE_READ;
 +	char *subvol_name = NULL;
 +	u64 subvol_objectid = 0;
 +	int error = 0;
 +
- 	if (!(flags & MS_RDONLY))
++	if (!(flags & SB_RDONLY))
 +		mode |= FMODE_WRITE;
 +
 +	error = btrfs_parse_subvol_options(data, mode, fs_type,
 +					  &subvol_name, &subvol_objectid);
 +	if (error) {
 +		kfree(subvol_name);
 +		return ERR_PTR(error);
 +	}
 +
 +	/* mount device's root (/) */
 +	mnt_root = vfs_kern_mount(&btrfs_root_fs_type, flags, device_name, data);
 +	if (PTR_ERR_OR_ZERO(mnt_root) == -EBUSY) {
- 		if (flags & MS_RDONLY) {
- 			mnt_root = vfs_kern_mount(&btrfs_root_fs_type, flags & ~MS_RDONLY,
++		if (flags & SB_RDONLY) {
++			mnt_root = vfs_kern_mount(&btrfs_root_fs_type, flags & ~SB_RDONLY,
 +					     device_name, data);
 +		} else {
- 			mnt_root = vfs_kern_mount(&btrfs_root_fs_type, flags | MS_RDONLY,
++			mnt_root = vfs_kern_mount(&btrfs_root_fs_type, flags | SB_RDONLY,
 +					     device_name, data);
 +			if (IS_ERR(mnt_root)) {
 +				root = ERR_CAST(mnt_root);
 +				goto out;
 +			}
 +
 +			down_write(&mnt_root->mnt_sb->s_umount);
 +			error = btrfs_remount(mnt_root->mnt_sb, &flags, NULL);
 +			up_write(&mnt_root->mnt_sb->s_umount);
 +			if (error < 0) {
 +				root = ERR_PTR(error);
 +				mntput(mnt_root);
 +				goto out;
 +			}
 +		}
 +	}
 +	if (IS_ERR(mnt_root)) {
 +		root = ERR_CAST(mnt_root);
 +		goto out;
 +	}
 +
 +	/* mount_subvol() will free subvol_name and mnt_root */
 +	root = mount_subvol(subvol_name, subvol_objectid, flags,
 +				    device_name, data, mnt_root);
 +
 +out:
 +	return root;
 +}
 +
  static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
  				     int new_pool_size, int old_pool_size)
  {

             reply	other threads:[~2017-11-08 22:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08 22:47 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-08-02  0:31 linux-next: manual merge of the vfs tree with the btrfs-kdave tree Stephen Rothwell
2017-09-14  0:31 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=20171109094717.011fe53a@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=dhowells@redhat.com \
    --cc=dsterba@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=misono.tomohiro@jp.fujitsu.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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).