Re: [PATCH RFC 05/10] pidfs: record exit code and cgroupid at exit

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

 



On 02/28, Christian Brauner wrote:
>
> +void pidfs_exit(struct task_struct *tsk)
> +{
> +	struct dentry *dentry;
> +
> +	dentry = stashed_dentry_get(&task_pid(tsk)->stashed);
> +	if (dentry) {
> +		struct inode *inode;
> +		struct pidfs_exit_info *exit_info;
> +#ifdef CONFIG_CGROUPS
> +		struct cgroup *cgrp;
> +#endif
> +		inode = d_inode(dentry);
> +		exit_info = &pidfs_i(inode)->exit_info;
> +
> +		/* TODO: Annoy Oleg to tell me how to do this correctly. */
> +		if (tsk->signal->flags & SIGNAL_GROUP_EXIT)
> +			exit_info->exit_code = tsk->signal->group_exit_code;
> +		else
> +			exit_info->exit_code = tsk->exit_code;

I think you don't need to check SIGNAL_GROUP_EXIT,

		exit_info->exit_code = tsk->exit_code;

should be fine.

Yes, if SIGNAL_GROUP_EXIT is already set then signal->group_exit_code
can differ.

But this can only happen if the "current" thread exits on its own using
sys_exit() and it races with another thread which does sys_exit_group()
and sets SIGNAL_GROUP_EXIT.

In this case pidfs_exit() can miss SIGNAL_GROUP_EXIT anyway, but we don't
care.  This doesn't differ from the case when current exits, and then
another thread does sys_exit_group() or exec().

Just in case... If current exits because it was killed by sys_exit_group()
from another thread, current->exit_code will be correct, it will be equal
to signal->group_exit_code.

But I am not sure I understand the next patch. let me check...

Oleg.





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

  Powered by Linux