LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Jeff Garzik <jeff@garzik.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alan Cox <alan@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: libata-core.c: unsafe cancel_delayed_work() usage?
Date: Wed, 2 May 2007 03:48:22 +0400	[thread overview]
Message-ID: <20070501234822.GA277@tv-sign.ru> (raw)
In-Reply-To: <4637CEAA.7070102@garzik.org>

On 05/01, Jeff Garzik wrote:
>
> Oleg Nesterov wrote:
> >
> >Alan, the usage of cancel_delayed_work() in drivers/ata/libata-core.c looks
> >suspicious to me, both ->hotplug_task and ->port_task can re-arm 
> >themselves,
> >so cancel_delayed_work + flush_workqueue (or cancel_work_sync) is not 
> >enough.
> >
> >Could you confirm/nack my understanding?
> 
> For all rearming workqueues, one must use cancel-rearming-blahblah.

Well, yes and no. cancel_rearming_delayed_work() requires that dwork
re-arms itself unconditionally, otherwise it just hangs (actually, the
patch to fix this shortcoming is ready). However, ata_pio_task() for
example, re-arms only when ATA_BUSY.

So it is very possible that the code is correct, if the caller of
ata_port_flush_task() ensures that ATA_BUSY is not possible. Otherwise
we should change cancel_rearming_delayed_work() and use it.

Oleg.


  reply	other threads:[~2007-05-01 23:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25 23:10 2.6.21-rc7-mm1: BUG_ON in kthread_bind during _cpu_down Rafael J. Wysocki
2007-04-25 23:54 ` Andrew Morton
2007-04-26 10:09   ` Gautham R Shenoy
2007-04-26 10:15     ` Oleg Nesterov
2007-04-26 12:58       ` Gautham R Shenoy
2007-04-28  1:42         ` Andrew Morton
2007-05-01 18:48           ` [PATCH] add-suspend-related-notifications-for-cpu-hotplug-cleanup Oleg Nesterov
2007-05-01 22:56           ` libata-core.c: unsafe cancel_delayed_work() usage? Oleg Nesterov
2007-05-01 23:35             ` Jeff Garzik
2007-05-01 23:48               ` Oleg Nesterov [this message]
2007-05-03 21:38           ` kernel/relay.c: a strange usage of delayed_work Oleg Nesterov
2007-05-04  5:42             ` Tom Zanussi
2007-04-26 10:20     ` 2.6.21-rc7-mm1: BUG_ON in kthread_bind during _cpu_down Eric W. Biederman
2007-04-26 20:20   ` Rafael J. Wysocki

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=20070501234822.GA277@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=alan@redhat.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: libata-core.c: unsafe cancel_delayed_work() usage?' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).