nvme: use kref_get_unless_zero in nvme_find_get_ns
authorChristoph Hellwig <hch@lst.de>
Wed, 18 Oct 2017 11:20:01 +0000 (13:20 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 27 Oct 2017 06:02:58 +0000 (09:02 +0300)
commit2dd4122854f697afc777582d18548dded03ce5dd
treeff1dfb91c68fb749ab29913e036896e166a15139
parente62a538da2e7401bad5293d210ce00583ac12f39
nvme: use kref_get_unless_zero in nvme_find_get_ns

For kref_get_unless_zero to protect against lookup vs free races we need
to use it in all places where we aren't guaranteed to already hold a
reference.  There is no such guarantee in nvme_find_get_ns, so switch to
kref_get_unless_zero in this function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
drivers/nvme/host/core.c