Re: [PATCH v2] dm mpath: fix race condition between multipath_dtr and pg_init_done

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

 



On Thu, Oct 31, 2013 at 10:48:13AM -0400, Mike Snitzer wrote:
> --- linux.orig/drivers/md/dm-mpath.c
> +++ linux/drivers/md/dm-mpath.c

> +	unsigned pg_init_disabled:1;	/* pginit is currently not allowed */

> +	if (m->pg_init_required && !m->pg_init_in_progress && pgpath &&
> +	    !m->pg_init_disabled)

So we're accepting that pg_init might be both "disabled" and "required"
simultaneously (otherwise we wouldn't need this test)?

> @@ -942,10 +944,20 @@ static void multipath_wait_for_pg_init_c
>  static void flush_multipath_work(struct multipath *m)
>  {
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&m->lock, flags);
> +	m->pg_init_disabled = 1;
> +	spin_unlock_irqrestore(&m->lock, flags);
> +
>  	flush_workqueue(kmpath_handlerd);
>  	multipath_wait_for_pg_init_completion(m);

So this implies pg_init could even still be running while it is disabled?

If the logic is correct, then I find the new variable name quite confusing and
think it should be changed, or as a minimum have inline comments explaining
the apparent contradictions!

Alasdair

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux