Re: [PATCH v2] libata, freezer: avoid block device removal whilesystem is frozen

From: Tejun Heo
Date: Wed Dec 18 2013 - 06:08:18 EST


Hey, Rafael.

On Wed, Dec 18, 2013 at 02:04:35AM +0100, Rafael J. Wysocki wrote:
> > + * The core suspend/resume path is fundamentally broken due to
> > + * freezable kthreads and workqueue and may deadlock if a block
> > + * device gets removed while resume is in progress. I don't know
> > + * what the solution is short of removing freezable kthreads and
> > + * workqueues altogether.
>
> Do you mean the block device core or the SCSI core or something else? It would
> be good to clarify that here to avoid confusion.

Will clarify.

> > + * The following is an ugly hack to avoid kicking off device
> > + * removal while freezer is active. This is a joke but does avoid
> > + * this particular deadlock scenario.
> > + *
> > + * https://bugzilla.kernel.org/show_bug.cgi?id=62801
> > + * http://marc.info/?l=linux-kernel&m=138695698516487
> > + */
> > + while (pm_freezing)
> > + msleep(100);
>
> Why is the sleep time 100 ms exactly? And why does it matter?

Just a number I pulled out of my ass.

> For example, what would change if it were 10 ms?

Yeah, 10ms is my favorite human-visible polling duration too (because
it's slow enough not to cause overhead issues while fast enough to be
mostly unnoticeable to humans). This one doesn't really matter
because the operation's latency isn't something which the user would
wait for actively. That said, yeah, why not, I'll change it to 10ms.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/