All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Vagin <avagin@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: viro@zeniv.linux.org.uk,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tejun Heo <tj@kernel.org>, Li Zefan <lizefan@huawei.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	cgroups@vger.kernel.org, fenghua.yu@intel.com,
	torvalds@linux-foundation.org, ebiederm@xmission.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	mszeredi@redhat.com
Subject: Re: [PATCH 21/34] kernfs, sysfs, cgroup, intel_rdt: Support fs_context [ver #12]
Date: Thu, 6 Dec 2018 09:08:23 -0800	[thread overview]
Message-ID: <20181206170822.GA15790@gmail.com> (raw)
In-Reply-To: <20181119042340.GA31532@gmail.com>

On Sun, Nov 18, 2018 at 08:23:42PM -0800, Andrei Vagin wrote:
> On Fri, Sep 21, 2018 at 05:33:01PM +0100, David Howells wrote:
> > @@ -1993,57 +2009,53 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask, int ref_flags)
> >  	return ret;
> >  }
> >  
> > -struct dentry *cgroup_do_mount(struct file_system_type *fs_type, int flags,
> > -			       struct cgroup_root *root, unsigned long magic,
> > -			       struct cgroup_namespace *ns)
> > +int cgroup_do_get_tree(struct fs_context *fc)
> >  {
> > -	struct dentry *dentry;
> > -	bool new_sb;
> > +	struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
> > +	int ret;
> >  
> > -	dentry = kernfs_mount(fs_type, flags, root->kf_root, magic, &new_sb);
> > +	ctx->kfc.root = ctx->root->kf_root;
> > +
> > +	ret = kernfs_get_tree(fc);
> > +	if (ret < 0)
> > +		goto out_cgrp;
> >  
> >  	/*
> >  	 * In non-init cgroup namespace, instead of root cgroup's dentry,
> >  	 * we return the dentry corresponding to the cgroupns->root_cgrp.
> >  	 */
> > -	if (!IS_ERR(dentry) && ns != &init_cgroup_ns) {
> > +	if (ctx->ns != &init_cgroup_ns) {
> >  		struct dentry *nsdentry;
> >  		struct cgroup *cgrp;
> >  
> >  		mutex_lock(&cgroup_mutex);
> >  		spin_lock_irq(&css_set_lock);
> >  
> > -		cgrp = cset_cgroup_from_root(ns->root_cset, root);
> > +		cgrp = cset_cgroup_from_root(ctx->ns->root_cset, ctx->root);
> >  
> >  		spin_unlock_irq(&css_set_lock);
> >  		mutex_unlock(&cgroup_mutex);
> >  
> > -		nsdentry = kernfs_node_dentry(cgrp->kn, dentry->d_sb);
> > -		dput(dentry);
> > -		dentry = nsdentry;
> > +		nsdentry = kernfs_node_dentry(cgrp->kn, fc->root->d_sb);
> > +		if (IS_ERR(nsdentry))
> > +			return PTR_ERR(nsdentry);
> > +		dput(fc->root);
> > +		fc->root = nsdentry;
> >  	}
> >  
> > -	if (IS_ERR(dentry) || !new_sb)
> > -		cgroup_put(&root->cgrp);
> 
> I don't see where this cgroup_put() has been moved.

David, have you looked at this problem? It isn't fixed in linux-next
yet.

https://travis-ci.org/avagin/linux/jobs/463960763

Thanks,
Andrei

> 
> With this patch, the next script works only once, on the second attempt
> it hangs up on mounting a cgroup file system.
> 
> This is the only suspicious place in this patch what I have found.
> 
> [root@fc24 ~]# cat fs-vs-cg 
> d=$(mktemp -d /tmp/cg.XXXXXX)
> mkdir $d/a
> mkdir $d/b
> mount -t cgroup -o none,name=xxxx xxx $d/a
> mount -t cgroup -o none,name=xxxx xxx $d/b
> umount $d/a
> umount $d/b
> 
> [root@fc24 ~]# unshare -m --propagation private bash -x fs-vs-cg
> ++ mktemp -d /tmp/cg.XXXXXX
> + d=/tmp/cg.yUfagS
> + mkdir /tmp/cg.yUfagS/a
> + mkdir /tmp/cg.yUfagS/b
> + mount -t cgroup -o none,name=xxxx xxx /tmp/cg.yUfagS/a
> + mount -t cgroup -o none,name=xxxx xxx /tmp/cg.yUfagS/b
> + umount /tmp/cg.yUfagS/a
> + umount /tmp/cg.yUfagS/b
> [root@fc24 ~]# unshare -m --propagation private bash -x fs-vs-cg
> ++ mktemp -d /tmp/cg.XXXXXX
> + d=/tmp/cg.ippWUn
> + mkdir /tmp/cg.ippWUn/a
> + mkdir /tmp/cg.ippWUn/b
> + mount -t cgroup -o none,name=xxxx xxx /tmp/cg.ippWUn/a
> ^Z
> [1]+  Stopped                 unshare -m --propagation private bash -x fs-vs-cg
> 
> [root@fc24 ~]# ps
>   PID TTY          TIME CMD
>   556 pts/0    00:00:00 bash
>   591 pts/0    00:00:00 bash
>   595 pts/0    00:00:00 mount
>   596 pts/0    00:00:00 ps
> 
> [root@fc24 ~]# bg
> [1]+ unshare -m --propagation private bash -x fs-vs-cg &
> 
> [root@fc24 ~]# cat /proc/595/stack 
> [<0>] msleep+0x38/0x40
> [<0>] cgroup1_get_tree+0x4e1/0x72c
> [<0>] vfs_get_tree+0x5e/0x140
> [<0>] do_mount+0x326/0xc70
> [<0>] ksys_mount+0xba/0xd0
> [<0>] __x64_sys_mount+0x21/0x30
> [<0>] do_syscall_64+0x60/0x210
> [<0>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
> [<0>] 0xffffffffffffffff
> 

  reply	other threads:[~2018-12-06 17:08 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-21 16:30 [PATCH 00/34] VFS: Introduce filesystem context [ver #12] David Howells
2018-09-21 16:30 ` David Howells
2018-09-21 16:30 ` David Howells
2018-09-21 16:30 ` [PATCH 01/34] vfs: syscall: Add open_tree(2) to reference or clone a mount " David Howells
2018-10-21 16:41   ` Eric W. Biederman
2018-09-21 16:30 ` [PATCH 02/34] vfs: syscall: Add move_mount(2) to move mounts around " David Howells
2018-09-21 16:30 ` [PATCH 03/34] teach move_mount(2) to work with OPEN_TREE_CLONE " David Howells
2018-10-05 18:24   ` Alan Jenkins
2018-10-07 10:48     ` Alan Jenkins
2018-10-07 19:20       ` Alan Jenkins
2018-10-10 12:36         ` David Howells
2018-10-12 14:22           ` Alan Jenkins
2018-10-12 14:22             ` Alan Jenkins
2018-10-12 14:54             ` David Howells
2018-10-12 14:57               ` Alan Jenkins
2018-10-11  9:17         ` David Howells
2018-10-11 11:48           ` Alan Jenkins
2018-10-11 13:10             ` David Howells
2018-10-11 12:14           ` David Howells
2018-10-11 12:23             ` Alan Jenkins
2018-10-11 15:33         ` David Howells
2018-10-11 18:38           ` Eric W. Biederman
2018-10-11 20:17             ` David Howells
2018-10-13  6:06               ` Al Viro
2018-10-17 17:45       ` Alan Jenkins
2018-10-18 20:09       ` David Howells
2018-10-18 20:58         ` David Howells
2018-10-19 11:57           ` David Howells
2018-10-19 13:37       ` David Howells
2018-10-19 17:35         ` Alan Jenkins
2018-10-19 21:35           ` David Howells
2018-10-19 21:40           ` David Howells
2018-10-19 22:36           ` David Howells
2018-10-20  5:25             ` Al Viro
2018-10-20 11:06             ` Alan Jenkins
2018-10-20 11:48               ` Al Viro
2018-10-20 11:48                 ` Al Viro
2018-10-20 12:26                 ` Al Viro
2018-10-21  0:40               ` David Howells
2018-10-10 11:56     ` David Howells
2018-10-10 12:31     ` David Howells
2018-10-10 12:39       ` Alan Jenkins
2018-10-10 12:50     ` David Howells
2018-10-10 13:02     ` David Howells
2018-10-10 13:06       ` Alan Jenkins
2018-10-21 16:57   ` Eric W. Biederman
2018-10-23 11:19   ` Alan Jenkins
2018-10-23 16:22     ` Al Viro
2018-09-21 16:30 ` [PATCH 04/34] vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled " David Howells
2018-09-21 16:30 ` [PATCH 05/34] vfs: Introduce the basic header for the new mount API's filesystem context " David Howells
2018-09-21 16:30 ` [PATCH 06/34] vfs: Introduce logging functions " David Howells
2018-09-21 16:31 ` [PATCH 07/34] vfs: Add configuration parser helpers " David Howells
2019-03-14  7:46   ` Geert Uytterhoeven
2019-03-14 10:27     ` David Howells
2019-03-14 10:49       ` Geert Uytterhoeven
2018-09-21 16:31 ` [PATCH 08/34] vfs: Add LSM hooks for the new mount API " David Howells
2018-09-21 16:31   ` David Howells
2018-09-21 16:31 ` [PATCH 09/34] vfs: Put security flags into the fs_context struct " David Howells
2018-09-21 16:31 ` [PATCH 10/34] selinux: Implement the new mount API LSM hooks " David Howells
2018-09-21 16:31   ` David Howells
2018-09-21 16:31 ` [PATCH 11/34] smack: Implement filesystem context security " David Howells
2018-09-21 16:31   ` David Howells
2018-09-21 16:31 ` [PATCH 12/34] apparmor: Implement security hooks for the new mount API " David Howells
2018-09-21 16:31   ` David Howells
2018-09-21 16:31 ` [PATCH 13/34] tomoyo: " David Howells
2018-09-21 16:31   ` David Howells
2018-09-21 16:32 ` [PATCH 14/34] vfs: Separate changing mount flags full remount " David Howells
2018-09-21 16:32 ` [PATCH 15/34] vfs: Implement a filesystem superblock creation/configuration context " David Howells
2018-09-21 16:32 ` [PATCH 16/34] vfs: Remove unused code after filesystem context changes " David Howells
2018-09-21 16:32 ` [PATCH 17/34] procfs: Move proc_fill_super() to fs/proc/root.c " David Howells
2018-09-21 16:32 ` [PATCH 18/34] proc: Add fs_context support to procfs " David Howells
2018-09-21 16:32 ` [PATCH 19/34] ipc: Convert mqueue fs to fs_context " David Howells
2018-09-21 16:32 ` [PATCH 20/34] cpuset: Use " David Howells
2018-09-21 16:33 ` [PATCH 21/34] kernfs, sysfs, cgroup, intel_rdt: Support " David Howells
2018-11-19  4:23   ` Andrei Vagin
2018-12-06 17:08     ` Andrei Vagin [this message]
2018-09-21 16:33 ` [PATCH 22/34] hugetlbfs: Convert to " David Howells
2018-09-21 16:33 ` [PATCH 23/34] vfs: Remove kern_mount_data() " David Howells
2018-09-21 16:33 ` [PATCH 24/34] vfs: Provide documentation for new mount API " David Howells
2018-09-21 16:33 ` [PATCH 25/34] Make anon_inodes unconditional " David Howells
2018-09-21 16:33 ` [PATCH 26/34] vfs: syscall: Add fsopen() to prepare for superblock creation " David Howells
2018-09-21 16:33 ` [PATCH 27/34] vfs: Implement logging through fs_context " David Howells
2018-09-21 16:33 ` [PATCH 28/34] vfs: Add some logging to the core users of the fs_context log " David Howells
2018-09-21 16:34 ` [PATCH 29/34] vfs: syscall: Add fsconfig() for configuring and managing a context " David Howells
2018-09-21 16:34 ` [PATCH 30/34] vfs: syscall: Add fsmount() to create a mount for a superblock " David Howells
2018-09-21 16:34 ` [PATCH 31/34] vfs: syscall: Add fspick() to select a superblock for reconfiguration " David Howells
2018-10-12 14:49   ` Alan Jenkins
2018-10-13  6:11     ` Al Viro
2018-10-13  6:11       ` Al Viro
2018-10-13  9:45       ` Alan Jenkins
2018-10-13 23:04         ` Andy Lutomirski
2018-10-17 13:15         ` David Howells
2018-10-17 13:20           ` David Howells
2018-10-17 13:20             ` David Howells
2018-10-17 14:31             ` Alan Jenkins
2018-10-17 14:35               ` Eric W. Biederman
2018-10-17 14:55                 ` Alan Jenkins
2018-10-17 15:24                 ` David Howells
2018-10-17 15:24                   ` David Howells
2018-10-17 15:38                   ` Eric W. Biederman
2018-10-17 15:45               ` David Howells
2018-10-17 17:41                 ` Alan Jenkins
2018-10-17 21:20                   ` David Howells
2018-10-17 22:13                 ` Alan Jenkins
2018-09-21 16:34 ` [PATCH 32/34] afs: Add fs_context support " David Howells
2018-09-21 16:34 ` [PATCH 33/34] afs: Use fs_context to pass parameters over automount " David Howells
2018-09-21 16:34 ` [PATCH 34/34] vfs: Add a sample program for the new mount API " David Howells
2018-12-17 14:12   ` Anders Roxell
2018-12-20 16:36     ` David Howells
2018-10-04 18:37 ` [PATCH 00/34] VFS: Introduce filesystem context " Eric W. Biederman

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=20181206170822.GA15790@gmail.com \
    --to=avagin@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=fenghua.yu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mszeredi@redhat.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.