On Wed, Jan 16, 2013 at 10:52 AM, Tejun Heo <t...@kernel.org> wrote:
> If the default iosched is built as module, the kernel may deadlock
> while trying to load the iosched module on device probe if the probing
> was running off async.  This is because async_synchronize_full() at
> the end of module init ends up waiting for the async job which
> initiated the module loading.
>
>  async A                                modprobe
>
>  1. finds a device
>  2. registers the block device
>  3. request_module(default iosched)
>                                         4. modprobe in userland
>                                         5. load and init module
>                                         6. async_synchronize_full()
>
> Async A waits for modprobe to finish in request_module() and modprobe
> waits for async A to finish in async_synchronize_full().
>
> Because there's no easy to track dependency once control goes out to
> userland, implementing properly nested flushing is difficult.  For
> now, make module init perform async_synchronize_full() iff module init
> has queued async jobs as suggested by Linus.
>
> This avoids the described deadlock because iosched module doesn't use
> async and thus wouldn't invoke async_synchronize_full().  This is
> hacky and incomplete.  It will deadlock if async module loading nests;
> however, this works around the known problem case and seems to be the
> best of bad options.
>
> For more details, please refer to the following thread.
>
>   http://thread.gmane.org/gmane.linux.kernel/1420814
>
> Signed-off-by: Tejun Heo <t...@kernel.org>
> Reported-by: Alex Riesen <raa.l...@gmail.com>
> Cc: Linus Torvalds <torva...@linux-foundation.org>
> ---

Looks it does fix the deadlock problem on my Pandaboard,
also the scsi disk device node(/dev/sdX) comes just
after loading module of 'sd_mod'.

Tested-by: Ming Lei <ming....@canonical.com>

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

Reply via email to