lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6bdd914-7c6d-032f-6412-9bd097f7c059@puri.sm>
Date:   Mon, 11 Jan 2021 16:31:10 +0100
From:   Martin Kepplinger <martin.kepplinger@...i.sm>
To:     jejb@...ux.ibm.com, martin.petersen@...cle.com,
        stern@...land.harvard.edu, bvanassche@....org
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] scsi: sd: add support for expect_media_change_suspend
 flag

On 11.01.21 16:20, Martin Kepplinger wrote:
> Make the sd driver act appropriately when the user has set
> expect_media_change_suspend for a device.
> 
> Signed-off-by: Martin Kepplinger <martin.kepplinger@...i.sm>
> ---
>   drivers/scsi/sd.c | 21 ++++++++++++++++++++-
>   1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index a3d2d4bc4a3d..ad89f8c76a27 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -608,7 +608,7 @@ static const struct dev_pm_ops sd_pm_ops = {
>   	.poweroff		= sd_suspend_system,
>   	.restore		= sd_resume,
>   	.runtime_suspend	= sd_suspend_runtime,
> -	.runtime_resume		= sd_resume,
> +	.runtime_resume		= sd_resume_runtime,
>   };
>   
>   static struct scsi_driver sd_template = {
> @@ -3699,6 +3699,25 @@ static int sd_resume(struct device *dev)
>   	return ret;
>   }
>   
> +static int sd_resume_runtime(struct device *dev)
> +{
> +	struct scsi_disk *sdkp = dev_get_drvdata(dev);
> +	int ret;
> +
> +	if (!sdkp)	/* E.g.: runtime resume at the start of sd_probe() */
> +		return 0;
> +
> +	/*
> +	 * expect_media_change_suspend is the userspace setting and
> +	 * expecting_media_change is what is checked and cleared in the
> +	 * error path if we set it here.
> +	 */
> +	if (sdkp->device->expect_media_change_suspend)
> +		sdkp->device->expecting_media_change = 1;
> +
> +	return sd_resume(dev);
> +}
> +
>   /**
>    *	init_sd - entry point for this driver (both when built in or when
>    *	a module).
> 

oops, I'm very sorry, but the following is missing in order for this to 
build:

--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -114,6 +114,7 @@ static void sd_shutdown(struct device *);
  static int sd_suspend_system(struct device *);
  static int sd_suspend_runtime(struct device *);
  static int sd_resume(struct device *);
+static int sd_resume_runtime(struct device *);
  static void sd_rescan(struct device *);
  static blk_status_t sd_init_command(struct scsi_cmnd *SCpnt);
  static void sd_uninit_command(struct scsi_cmnd *SCpnt);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ