On Wed, 2019-03-20 at 12:39 +-0100, Hannes Reinecke wrote: +AD4 The 'ch+AF8-mutex+ACI is meant to guard against modifications of +AD4 file-+AD4-private+AF8-data, so we need to take in in ch+AF8-release() as +AD4 well as in ch+AF8-open(). +AD4 +AD4 Signed-off-by: Hannes Reinecke +ADw-hare+AEA-suse.de+AD4 +AD4 --- +AD4 drivers/scsi/ch.c +AHw 2 ++1filechanged2insertions() +AD4 +AD4 diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c +AD4 index 1c5051b1c125..8f426903d7e4 100644 +AD4 --- a/drivers/scsi/ch.c +AD4 +-+-+- b/drivers/scsi/ch.c +AD4 +AEAAQA -577,9 +-577,11 +AEAAQA ch+AF8-release(struct inode +ACo-inode, struct file +ACo-file) +AD4 +AHs +AD4 scsi+AF8-changer +ACo-ch +AD0 file-+AD4-private+AF8-data+ADs +AD4 +AD4 +- mutex+AF8-lock(+ACY-ch+AF8-mutex)+ADs +AD4 scsi+AF8-device+AF8-put(ch-+AD4-device)+ADs +AD4 ch-+AD4-device +AD0 NULL+ADs +AD4 file-+AD4-private+AF8-data +AD0 NULL+ADs +AD4 +- mutex+AF8-unlock(+ACY-ch+AF8-mutex)+ADs +AD4 kref+AF8-put(+ACY-ch-+AD4-ref, ch+AF8-destroy)+ADs +AD4 return 0+ADs +AD4 +AH0 Hi Hannes, My interpretation of the open() syscall code (do+AF8-sys+AF8-open()) is that a new struct file is allocated every time the open() is called. Does that mean that the lock and unlock calls for ch+AF8-mutex can be removed from ch+AF8-open()? Regarding the above patch: why do you think that file-+AD4-private+AF8-data changes need to be serialized? I don't know any other file+AF8-operations::open / close callback implementations that implement similar serialization. Thanks, Bart.