Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Lee Duncan <lduncan@suse.com>
To: linux-scsi@vger.kernel.org
Cc: "James Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Kai Mäkisara" <kai.makisara@kolumbus.fi>,
	"Jeff Mahoney" <jeffm@suse.com>
Subject: Re: [PATCH] st: remove st_mutex
Date: Mon, 10 Sep 2012 15:24:38 -0700	[thread overview]
Message-ID: <504E68A6.2070102@suse.com> (raw)
In-Reply-To: <504E62D2.8030904@suse.com>

Please disregard this patch -- I have the meta-data wrong.

I'll resubmit.

On 09/10/2012 02:59 PM, Lee Duncan wrote:
> This patch is based on the "misc" branch of the SCSI tree
> and the 5-patch series for st sent by Jeff Mahoney 8/18/2012
> and Ack-ed by Kai on 8/20.
> 
> From: Jeff Mahoney <jeffm@suse.com>
> 
> The st_mutex was created when the BKL was removed, and
> prevents simultaneous st_open calls. It is better to
> protect just the necessary data.
> 
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> Reviewed-by: Lee Duncan <lduncan@suse.com>
> ---
>  drivers/scsi/st.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index ceca095..98156a9 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -75,7 +75,6 @@ static const char *verstr = "20101219";
>  #include "st_options.h"
>  #include "st.h"
> 
> -static DEFINE_MUTEX(st_mutex);
>  static int buffer_kbs;
>  static int max_sg_segs;
>  static int try_direct_io = TRY_DIRECT_IO;
> @@ -1185,7 +1184,6 @@ static int st_open(struct inode *inode, struct
> file *filp)
>  	int dev = TAPE_NR(inode);
>  	char *name;
> 
> -	mutex_lock(&st_mutex);
>  	/*
>  	 * We really want to do nonseekable_open(inode, filp); here, but some
>  	 * versions of tar incorrectly call lseek on tapes and bail out if that
> @@ -1194,7 +1192,6 @@ static int st_open(struct inode *inode, struct
> file *filp)
>  	filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
> 
>  	if (!(STp = scsi_tape_get(dev))) {
> -		mutex_unlock(&st_mutex);
>  		return -ENXIO;
>  	}
> 
> @@ -1205,7 +1202,6 @@ static int st_open(struct inode *inode, struct
> file *filp)
>  	if (STp->in_use) {
>  		spin_unlock(&st_use_lock);
>  		scsi_tape_put(STp);
> -		mutex_unlock(&st_mutex);
>  		DEB( printk(ST_DEB_MSG "%s: Device already in use.\n", name); )
>  		return (-EBUSY);
>  	}
> @@ -1259,16 +1255,16 @@ static int st_open(struct inode *inode, struct
> file *filp)
>  			retval = (-EIO);
>  		goto err_out;
>  	}
> -	mutex_unlock(&st_mutex);
>  	return 0;
> 
>   err_out:
>  	normalize_buffer(STp->buffer);
> +	spin_lock(&st_use_lock);
>  	STp->in_use = 0;
> +	spin_unlock(&st_use_lock);
>  	scsi_tape_put(STp);
>  	if (resumed)
>  		scsi_autopm_put_device(STp->device);
> -	mutex_unlock(&st_mutex);
>  	return retval;
> 
>  }
> 

-- 
Lee Duncan
SUSE Labs

      reply	other threads:[~2012-09-10 22:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10 21:59 [PATCH] st: remove st_mutex Lee Duncan
2012-09-10 22:24 ` Lee Duncan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=504E68A6.2070102@suse.com \
    --to=lduncan@suse.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=jeffm@suse.com \
    --cc=kai.makisara@kolumbus.fi \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox