]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] bsg: takes a ref to struct device in fops->open
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Mon, 31 Mar 2008 01:03:38 +0000 (10:03 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 18 Apr 2008 16:47:19 +0000 (11:47 -0500)
commitb645fc130fb30114a1c1c0c564d9281264b32a9d
treef620055da979b1af58bfdac16f35f90cd67e6f13
parent6b6e5168d1ab8ed215c6137d450da5afb966219a
[SCSI] bsg: takes a ref to struct device in fops->open

bsg_register_queue() takes a ref to struct device that a caller
passes. For example, bsg takes a ref to the sdev_gendev for scsi
devices. However, bsg doesn't inrease the refcount in fops->open. So
while an application opens a bsg device, the scsi device that the bsg
device holds can go away (bsg also takes a ref to a queue, but it
doesn't prevent the device from going away).

With this patch, bsg increases the refcount of struct device in
fops->open and decreases it in fops->release.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
block/bsg.c