On 14-06-13 05:03 AM, Christoph Hellwig wrote:
Hi Doug, this looks generally good to me, but I don't think open_cnt and exclude have to use atomic_t, as they are only ever modified under open_rel_lock.
They are read by 'cat /proc/scsi/sg/debug' [in sg_proc_seq_show_debug()] but transient off-by-1 reports are not so important. [Prior to locking that block with read_lock(sfd_lock) that routine sometimes printed wild results, so some care is required.]
Can you take a look at the version below? This changes open_cnt to an int, exclude to a bool, removes the open_cnt underflow check that the VFS takes care for, and streamlines the open path a little bit:
sg_open() and sg_release() clean-up looks good. The back-up goto at the end of sg_open() reminds me of Fortran style :-) More importantly my sg_tst_excl* tests give this version the thumbs up. Acked-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html