Re: [PATCH 4/9] uml: fix spinlock recursion and sleep-inside-spinlock in error path

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

 



"Paolo 'Blaisorblade' Giarrusso" <[email protected]> wrote:
>
> 
> From: Paolo 'Blaisorblade' Giarrusso <[email protected]>
> 
> In this error path, when the interface has had a problem, we call dev_close(),
> which is disallowed for two reasons:
> 
> *) takes again the UML internal spinlock, inside the ->stop method of this
>    device
> *) can be called in process context only, while we're in interrupt context.
> 
> I've also thought that calling dev_close() may be a wrong policy to follow, but
> it's not up to me to decide that.
> 
> However, we may end up with multiple dev_close() queued on the same device.
> But the initial test for (dev->flags & IFF_UP) makes this harmless, though -
> and dev_close() is supposed to care about races with itself. So there's no harm
> in delaying the shutdown, IMHO.
> 
> Something to mark the interface as "going to shutdown" would be appreciated, but
> dev_deactivate has the same problems as dev_close(), so we can't use it either.
> 
> ...
> +		/* dev_close can't be called in interrupt context, and takes
> +		 * again lp->lock.
> +		 * And dev_close() can be safely called multiple times on the
> +		 * same device, since it tests for (dev->flags & IFF_UP). So
> +		 * there's no harm in delaying the device shutdown. */
> +		schedule_work(&close_work);
>  		goto out;
>  	}

This callback can be pending for an arbitrary amount of time.  I'd have
expected to see a flush_sceduled_work() somewhere in the driver to force
all such pending work to complete before we destroy things which that
callback wil be using.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux