drivers/scsi/st.c: decrement in_use under the lock in st_open
Subsystems (2)
PATCH 1/1 drivers/scsi/st.c: decrement in_use under the lock in st_open
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
drivers/scsi/st.c renamed from drivers/scsi/st.c.orig +2 -0
@@ -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;
Quoted 6 lines · Nate Dailey
Hi, this patch changes the
err_outcase inst_opento decrementSTp->in_useunder thest_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_openand release hold the lock when adjustingin_usein 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.
Signature · 1 line
Kai