[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1582046914.16681.11.camel@linux.ibm.com>
Date: Tue, 18 Feb 2020 09:28:34 -0800
From: James Bottomley <jejb@...ux.ibm.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Merlijn Wajer <merlijn@...hive.org>, merlijn@...zup.org,
linux-scsi@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] scsi: sr: get rid of sr global mutex
On Tue, 2020-02-18 at 09:23 -0800, Christoph Hellwig wrote:
> On Tue, Feb 18, 2020 at 09:20:28AM -0800, James Bottomley wrote:
> > > > Replace the global mutex with per-sr-device mutex.
> > >
> > > Do we actually need the lock at all? What is protected by it?
> >
> > We do at least for cdrom_open. It modifies the cdi structure with
> > no other protection and concurrent modification would at least
> > screw up the use counter which is not atomic. Same reasoning for
> > cdrom_release.
>
> Wouldn't the right fix to add locking to cdrom_open/release instead
> of having an undocumented requirement for the callers?
Yes ... but that's somewhat of a bigger patch because you now have to
reason about the callbacks within cdrom. There's also the question of
whether you can assume ops->generic_packet() has its own concurrency
protections ... it's certainly true for SCSI, but is it for anything
else? Although I suppose you can just not care and run the internal
lock over it anyway.
James
Powered by blists - more mailing lists