All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@mellanox.com>
To: Parav Pandit <parav@mellanox.com>
Cc: Leon Romanovsky <leon@kernel.org>,
	Doug Ledford <dledford@redhat.com>,
	Leon Romanovsky <leonro@mellanox.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH rdma-next 2/2] RDMA/core: Check that process is still alive before sending it to the users
Date: Tue, 8 Oct 2019 19:11:55 +0000	[thread overview]
Message-ID: <20191008191151.GD22714@mellanox.com> (raw)
In-Reply-To: <AM0PR05MB4866CB24D8105C83B31988A3D19B0@AM0PR05MB4866.eurprd05.prod.outlook.com>

On Mon, Oct 07, 2019 at 06:58:13PM +0000, Parav Pandit wrote:
> > +	 * 2. Task is dead and in zombie state. There is no need to print PID
> > anymore.
> > +	 */
> > +	if (pid)
> > +		/*
> > +		 * This part is racy, task can be killed and PID will be zero right
> > +		 * here but it is ok, next query won't return PID. We don't
> > promise
> > +		 * real-time reflection of SW objects.
> > +		 */
> > +		err = nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_PID, pid);
> > +
> > +out:
> > +	return err ? -EMSGSIZE : 0;
> >  }
> 
> Below code reads better along with rest of the comments in the patch.
> 
> if (kern_resource) {
> 	err = nla_put_string(msg, RDMA_NLDEV_ATTR_RES_KERN_NAME,
> 			     res->kern_name);
> } else {
> 	pid_t pid;
> 
> 	pid = task_pid_vnr(res->task);
> 	if (pid)
> 		err = nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_PID, pid);
> }

I tend to agree, that the pid == 0 happens for !kernel is pretty
indirect

Jason

      parent reply	other threads:[~2019-10-08 19:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 12:32 [PATCH rdma-next 0/2] Remove PID namespaces support from restrack Leon Romanovsky
2019-10-02 12:32 ` [PATCH rdma-next 1/2] RDMA/restrack: Remove PID namespace support Leon Romanovsky
2019-10-02 12:32 ` [PATCH rdma-next 2/2] RDMA/core: Check that process is still alive before sending it to the users Leon Romanovsky
2019-10-07 18:58   ` Parav Pandit
2019-10-08  7:52     ` Leon Romanovsky
2019-10-08 13:46       ` Parav Pandit
2019-10-08 19:11     ` Jason Gunthorpe [this message]

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=20191008191151.GD22714@mellanox.com \
    --to=jgg@mellanox.com \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=parav@mellanox.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 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.