Re: [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style

From: Rafael J. Wysocki
Date: Mon May 07 2012 - 15:34:27 EST


On Monday, May 07, 2012, Minho Ban wrote:
> name_to_dev_t is not enough to check device detection when the resume_file is
> MAJOR:MINOR format.

It's not assumed to be in that format, although I suppose we can add the
possibility to specify it this way.

> get_gendisk is needed in that case.
>
> Signed-off-by: Minho Ban <mhban@xxxxxxxxxxx>
> ---
> kernel/power/hibernate.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index e09dfbf..27efaef 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -25,6 +25,8 @@
> #include <linux/freezer.h>
> #include <linux/gfp.h>
> #include <linux/syscore_ops.h>
> +#include <linux/ctype.h>
> +#include <linux/genhd.h>
> #include <scsi/scsi_scan.h>
>
> #include "power.h"
> @@ -749,6 +751,14 @@ static int software_resume(void)
> }
> }
>
> + /* name_to_dev_t is ineffective if resume_file comes in major:minor
> + * format */
> + if (isdigit(resume_file[0]) && resume_wait) {

The check here is too late. It should be done before name_to_dev_t() is
used on resume_file for the first time.

> + int partno;
> + while (!get_gendisk(swsusp_resume_device, &partno))
> + msleep(10);
> + }
> +
> Check_image:
> pr_debug("PM: Hibernation image partition %d:%d present\n",
> MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));

Besides, I'd like the documentation to be updated to reflect this change too.

Thanks,
Rafael
--
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/