Re: [PATCH 31/34] vfs: syscall: Add fspick() to select a superblock for reconfiguration [ver #12]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[resent, hopefully with slightly less formatting damage]

On 17/10/2018 16:45, David Howells wrote:

Alan Jenkins <alan.christopher.jenkins@xxxxxxxxx> wrote:

I agree. I'm happy to see this is using the same check as do_remount().


* change filesystem flags. dir should be a physical root of filesystem.
* If you've mounted a non-root directory somewhere and want to do remount
* on it - tough luck.
*/
Are you suggesting that it should only work at the ultimate root of a
superblock and not a bind mount somewhere within?

That's tricky to make work for NFS because s_root is a dummy dentry.

David


Retro-actively: I do not suggest that.

I tried to answer this question in my reply to Eric correcting me. Eric was right to correct me.  I now understand the comment above do_remount() is incorrect.  I re-reviewed your diff in light of that.  I re-endorse your diff as a way to solve the problem I raised.

(I think it would be useful to remove the misleading comment above do_remount(), to avoid future confusion.)


@@ -186,6 +186,10 @@ SYSCALL_DEFINE3(fspick, int, dfd, const char __user *, path, unsigned int, flags
  	if (ret < 0)
  		goto err;
+ ret = -EINVAL;
+	if (target.mnt->mnt_root != target.dentry)
+		goto err_path;
+
  	fc = vfs_new_fs_context(target.dentry->d_sb->s_type, target.dentry,
  				0, 0, FS_CONTEXT_FOR_RECONFIGURE);
  	if (IS_ERR(fc)) {


( the "if" statement it adds to fspick() is equivalent to the second "if" statement in do_remount(): )

static int do_remount(struct path *path, int ms_flags, int sb_flags,
		      int mnt_flags, void *data)
{
	int err;
	struct super_block *sb = path->mnt->mnt_sb;
	struct mount *mnt = real_mount(path->mnt);

	if (!check_mnt(mnt))
		return -EINVAL;

	if (path->dentry != path->mnt->mnt_root)
		return -EINVAL;

Thanks

Alan



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux