Kai Makisara wrote: >>The primary change is adding a kref to the Scsi_Tape structure, to avoid >>an oops when the tape drive is removed while open. This includes >>scsi_tape_get/put routines and scsi_tape_release, and changes to st_open >>and st_release. This is all based on the SCSI disk & CD reference >>counting code. >> > > You have added a new kref for this. Have you considered using the > existing cdev refcounting instead of a separate kref? > > (When the new character device code was introduced, I got the impression > that the proper way for the st would be to embed the struct into struct > scsi_tape and make the destructor. The scsi_tapes[] array would not be > necessary any more because the struct scsi_tape would be accessible through > containerof(inode->i_cdev, struct scsi_tape, cdev). > (An array would be still necessary for tape number allocation.) > I did not implement this at that time because there was no real need for > the change and it seemed too complex to test just for fun.) I'm not sure how you would do this since there is currently no way to embed data in a cdev. Also, since there are multiple cdevs per scsi_tape, it seems cleaner to use a new kref. -- Brian King eServer Storage I/O IBM Linux Technology Center - : 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