[sheepdog] [PATCH v3 3/6] md: add hot-plug and hot-unplug support

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Apr 3 10:21:40 CEST 2013


At Wed,  3 Apr 2013 14:27:44 +0800,
Liu Yuan wrote:
> 
>  static void md_do_recover(struct work *work)
>  {
>  	struct md_work *mw = container_of(work, struct md_work, work);
> @@ -383,7 +408,10 @@ static void md_do_recover(struct work *work)
>  	if (idx < 0)
>  		/* Just ignore the duplicate EIO of the same path */
>  		goto out;
> -	unplug_disk(idx);
> +	remove_disk(idx);
> +	sys->disk_space = md_init_space();

tests/055 emulates disk failure by removing the md direcotry, but
md_init_space() creates a new directory if it doesn't exist.  So, if
simultaneous two disk failures happen, the first md_do_recover() will
create a new md directory for the second disk and the second disk
failure will be cancelled (objects in the directory will be removed
though).

This might not be a problem because the md directory is a mount point
in the actual use cases.  However, it is cleaner to call mkdir() only
when starting sheepdog, I think.

Thanks,

Kazutaka

> +	if (md_nr_disks > 0)
> +		kick_recover();
>  out:
>  	pthread_rwlock_unlock(&md_lock);
>  	free(mw);



More information about the sheepdog mailing list