Re: [PATCH v5 03/23] scsi: hisi_sas: optimise the usage of hisi_hba.lock

From: Arnd Bergmann
Date: Mon Jun 12 2017 - 05:46:10 EST


On Mon, Jun 12, 2017 at 10:26 AM, John Garry <john.garry@xxxxxxxxxx> wrote:
> On 10/06/2017 21:44, kbuild test robot wrote:
>
>
> I don't think that reusing flags variable is in error, as there would be no
> nested spinlock at this point within the function.
>
> If it is not recommended or not permitted to reuse flags variable for
> separate spinlocks, then that can be changed - I don't know.

No, look again: coccinelle is right as the locks are nested in
https://github.com/0day-ci/linux/blob/bf95e9cccde4af4ed2012a6ec44d48b545d5ffed/drivers/scsi/hisi_sas/hisi_sas_main.c#L1208

dq->lock is already held and you acquire task->task_state_lock in
line 1208, which overwrites the flags.

Arnd