Re: [PATCH 4/4] Staging: lustre: sparse lock warning fix

From: Dan Carpenter
Date: Mon May 18 2015 - 17:21:43 EST


On Mon, May 18, 2015 at 08:34:51PM +0200, Adrian Remonda wrote:
> Fixed sparse warning: context imbalance in 'nrs_resource_put_safe' -
> 'different lock contexts for basic block' by releasing the lock on each
> iteration of the for loop.
>

That changelog doesn't sound correct at all. That's not a correct
motivation or explanation.

I reviewed the patch and it's likely going to cause dead locks. The code
is trying to take the spinlock for the first pointer in the array and
release it at the end. Now it takes the first pointer's spinlock a
bunch of times (dead lock) and releases it once (will not happen because
we are already dead).

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/