Received: from eggs.gnu.org ([208.118.235.92]:59702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpnRm-0000eb-Ke for qemu-devel@nongnu.org; Fri, 13 Jul 2012 17:30:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpnRl-0005KK-Pl for qemu-devel@nongnu.org; Fri, 13 Jul 2012 17:30:46 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:49657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpnRl-0005KF-L7 for qemu-devel@nongnu.org; Fri, 13 Jul 2012 17:30:45 -0400 Received: by ghrr14 with SMTP id r14so4437495ghr.4 for ; Fri, 13 Jul 2012 14:30:44 -0700 (PDT) From: Ronnie Sahlberg Date: Sat, 14 Jul 2012 07:30:39 +1000 Message-Id: <1342215040-16128-1-git-send-email-ronniesahlberg@gmail.com> Subject: [Qemu-devel] [PATCH] SCSI: Make write commands fail if the device is readonly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, pbonzini@redhat.com List, Paolo Please find a patch that makes WRITE and WRITE_VERIFY fail with DATA_PROTECT/WRITE_PROTECTED sense code for devices that are write-protected via readonly=on Tests have been berformed to verify the functionality using : ./x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 128 -drive file=20mb.img -drive file=./scsi-disk.img,if=scsi,readonly=on -net nic -net user,hostfwd=tcp:127.0.0.1:32601-:3260 -vnc 0.0.0.0:0 iscsi-test --dataloss --test="*300_readonly*" iscsi://127.0.0.1:32601/iqn.qemu.scsi-test/3 0300_readonly: ============== WRITE10 to LUN 0 ... [OK] WRITE12 to LUN 0 ... [OK] WRITE16 to LUN 0 ... [OK] WRITESAME10 to LUN 0 ... [OK] WRITESAME16 to LUN 0 ... [OK] WRITESAME10 to UNMAP LUN 0 ... LUN is not thin-provisioned. [SKIPPED] WRITESAME16 to UNMAP LUN 0 ... LUN is not thin-provisioned. [SKIPPED] UNMAP LUN 0 ... LUN is not thin-provisioned. [SKIPPED] TEST T0300_readonly [OK] regards ronnie sahlberg