* [PATCH] drivers/scsi/st.c: decrement in_use under the lock in st_open
@ 2005-04-21 15:08 Nate Dailey
2005-04-21 16:40 ` Kai Makisara
0 siblings, 1 reply; 2+ messages in thread
From: Nate Dailey @ 2005-04-21 15:08 UTC (permalink / raw)
To: Kai.Makisara; +Cc: linux-scsi
Hi, this patch changes the err_out case in st_open to decrement STp->in_use under the st_dev_arr_lock.
I'm just basing this on looking at the code (I didn't run into an actual problem here), but it seems like the right thing to do; st_open and release hold the lock when adjusting in_use in other places.
This is against kernel 2.6.12-rc2.
Nate Dailey
Stratus Technologies
Signed-off-by: Nate Dailey <nate.dailey@stratus.com>
--- linux-2.6.12-rc2/drivers/scsi/st.c.orig 2005-04-20 11:28:39.000000000 -0400
+++ linux-2.6.12-rc2/drivers/scsi/st.c 2005-04-20 11:30:08.000000000 -0400
@@ -1115,7 +1115,9 @@ static int st_open(struct inode *inode,
err_out:
normalize_buffer(STp->buffer);
+ write_lock(&st_dev_arr_lock);
STp->in_use = 0;
+ write_unlock(&st_dev_arr_lock);
scsi_device_put(STp->device);
return retval;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/scsi/st.c: decrement in_use under the lock in st_open
2005-04-21 15:08 [PATCH] drivers/scsi/st.c: decrement in_use under the lock in st_open Nate Dailey
@ 2005-04-21 16:40 ` Kai Makisara
0 siblings, 0 replies; 2+ messages in thread
From: Kai Makisara @ 2005-04-21 16:40 UTC (permalink / raw)
To: Nate Dailey; +Cc: linux-scsi
On Thu, 21 Apr 2005, Nate Dailey wrote:
> Hi, this patch changes the err_out case in st_open to decrement STp->in_use under the st_dev_arr_lock.
>
> I'm just basing this on looking at the code (I didn't run into an actual
> problem here), but it seems like the right thing to do; st_open and
> release hold the lock when adjusting in_use in other places.
>
I don't think it is necessary hold the lock when setting STp->in_use to
zero. The problem is that the usage is not consistent in st. Either this
patch should be included or the locking should be removed from st_release.
I don't have any strong opinions about the best solution.
Thanks for pointing out this inconsistency.
--
Kai
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-21 16:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-21 15:08 [PATCH] drivers/scsi/st.c: decrement in_use under the lock in st_open Nate Dailey
2005-04-21 16:40 ` Kai Makisara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox