From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UulEf-0007fD-BH for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:14:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UulEd-0004ps-1f for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:14:17 -0400 Received: from mail-wg0-x235.google.com ([2a00:1450:400c:c00::235]:59548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UulEc-0004pc-Qx for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:14:14 -0400 Received: by mail-wg0-f53.google.com with SMTP id y10so1233948wgg.8 for ; Thu, 04 Jul 2013 08:14:14 -0700 (PDT) Received: from playground.station (net-37-117-148-210.cust.dsl.vodafone.it. [37.117.148.210]) by mx.google.com with ESMTPSA id d8sm4212546wiz.0.2013.07.04.08.14.11 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Jul 2013 08:14:12 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 4 Jul 2013 17:12:58 +0200 Message-Id: <1372950842-32422-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1372950842-32422-1-git-send-email-pbonzini@redhat.com> References: <1372950842-32422-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 02/66] scsi: keep device alive while it has requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-bus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 53ea906..e443193 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -516,6 +516,8 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, req->status = -1; req->sense_len = 0; req->ops = reqops; + object_ref(OBJECT(d)); + object_ref(OBJECT(req->bus->qbus.parent)); trace_scsi_req_alloc(req->dev->id, req->lun, req->tag); return req; } @@ -1505,6 +1507,8 @@ void scsi_req_unref(SCSIRequest *req) if (req->ops->free_req) { req->ops->free_req(req); } + object_unref(OBJECT(req->dev)); + object_unref(OBJECT(bus->qbus.parent)); g_free(req); } } -- 1.8.1.4