mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Sébastien Dugué" <sebastien.dugue@bull.net>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Suparna Bhattacharya <suparna@in.ibm.com>,
	Ulrich Drepper <drepper@redhat.com>,
	Zach Brown <zach.brown@oracle.com>, Dave Jones <davej@redhat.com>,
	Jean Pierre Dion <jean-pierre.dion@bull.net>,
	"linux-aio@kvack.org" <linux-aio@kvack.org>
Subject: Re: [PATCH -mm 3/3][AIO] - AIO completion signal notification
Date: Fri, 10 Nov 2006 10:05:45 +0100	[thread overview]
Message-ID: <1163149545.3879.47.camel@frecb000686> (raw)
In-Reply-To: <1163097975.29807.18.camel@dyn9047017100.beaverton.ibm.com>

On Thu, 2006-11-09 at 10:46 -0800, Badari Pulavarty wrote:
> On Thu, 2006-11-09 at 16:59 +0100, Sébastien Dugué wrote:
> 
> > +
> > +static long aio_setup_sigevent(struct kiocb *iocb,
> > +			       struct sigevent __user *user_event)
> > +{
> > +	int error = 0;
> > +	sigevent_t event;
> > +	struct task_struct *target;
> > +	unsigned long flags;
> > +
> > +	if (!access_ok(VERIFY_READ, user_event, sizeof(struct sigevent)))
> > +		return -EFAULT;
> > +
> > +	if (copy_from_user(&event, user_event, sizeof (event)))
> > +		return -EFAULT;
> > +
> > +	/* Check for the SIGEV_NONE case */
> > +	if (event.sigev_notify == SIGEV_NONE)
> > +		return 0;
> > +
> > +	/* Setup the request completion notification parameters */
> > +	iocb->ki_notify.notify = event.sigev_notify;
> > +	iocb->ki_notify.signo = event.sigev_signo;
> > +	iocb->ki_notify.value = event.sigev_value;
> > +
> > +	/* Now get the notification target */
> > +	read_lock(&tasklist_lock);
> > +
> > +	if ((target = good_sigevent(&event))) {
> > +
> > +		spin_lock_irqsave(&target->sighand->siglock, flags);
> > +
> > +		if (!(target->flags & PF_EXITING)) {
> > +			iocb->ki_notify.target = target;
> > +
> > +			spin_unlock_irqrestore(&target->sighand->siglock, flags);
> > +
> > +			/*
> > +			 * Get a ref on the task. It is dropped in really_put_req()
> > +			 * when we're done with the iocb, be it from the normal
> > +			 * completion path, the cancellation path or an error path.
> > +			 */
> > +			if (iocb->ki_notify.notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
> > +				get_task_struct(target);
> > +		} else {
> > +			spin_unlock_irqrestore(&target->sighand->siglock, flags);
> > +			error = -EINVAL;
> > +		}
> > +	} else
> > +		error = -EINVAL;
> > +
> > +	read_unlock(&tasklist_lock);
> > +
> > +	if (!error) {
> > +		/*
> > +		 * Alloc a sigqueue for this request
> > +		 *
> > +		 * NOTE: we cannot free the sigqueue in the completion path as
> > +		 * the signal may not have been delivered to the target task.
> > +		 * Therefore it has to be freed in __sigqueue_free() when the
> > +		 * signal is collected if si_code is SI_ASYNCIO.
> > +		 */
> > +		if (unlikely(!(iocb->ki_sigq = sigqueue_alloc())))
> > +			error =  -EAGAIN;
> 
> Don't you have to do put_task_struct() here ?

  Well, put_task_struct() is called in really_put_req() when we're 
freeing the request. This should be OK unless I missed something.

  Sébastien.


  reply	other threads:[~2006-11-10  9:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-09 15:55 [PATCH -mm 0/3][AIO] " Sébastien Dugué
2006-11-09 15:58 ` [PATCH -mm 1/3][AIO] " Sébastien Dugué
2006-11-09 15:59 ` [PATCH -mm 2/3][AIO] " Sébastien Dugué
2006-11-09 15:59 ` [PATCH -mm 3/3][AIO] " Sébastien Dugué
2006-11-09 18:46   ` Badari Pulavarty
2006-11-10  9:05     ` Sébastien Dugué [this message]
2006-11-09 19:08   ` Christoph Hellwig
2006-11-09 19:27     ` Badari Pulavarty
2006-11-10  9:20       ` Sébastien Dugué
2006-11-10  9:14     ` Sébastien Dugué
2006-11-09 19:18   ` Badari Pulavarty
2006-11-10  9:22     ` Sébastien Dugué
2006-11-10  1:52   ` Badari Pulavarty
2006-11-10  1:54     ` Badari Pulavarty

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=1163149545.3879.47.camel@frecb000686 \
    --to=sebastien.dugue@bull.net \
    --cc=davej@redhat.com \
    --cc=drepper@redhat.com \
    --cc=jean-pierre.dion@bull.net \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbadari@us.ibm.com \
    --cc=suparna@in.ibm.com \
    --cc=zach.brown@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®