Re: [PATCH 05/10] block: drop unnecessary blk_get/put_queue() inscsi_cmd_ioctl() and blk_get_tg()

From: Tejun Heo
Date: Wed Oct 19 2011 - 12:35:35 EST


Hey, Vivek.

On Wed, Oct 19, 2011 at 09:52:54AM -0400, Vivek Goyal wrote:
> What makes sure that caller has the reference to the queue upon entry. If
> that's the case, that's good. Just that I had not figured it out so
> resorted to defensive programming as taking extra reference does not harm.

The fact that @q can be dereferenced on entry at all. :)

Taking extra reference doesn't help anything. If the caller doesn't
have standing reference, it will just change where oops occurs. W/o
extra ref, it will crash soon after the last reference is put. W/
extra ref, it will crash after the extra ref is put. If the caller
doesn't hold a reference, there's nothing the callee can do to fix
that.

Thanks.

--
tejun
--
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/