From: bugzilla-daemon@bugzilla.kernel.org
To: linux-scsi@kernel.org
Subject: [Bug 198689] New: Setro has no effect for SCSI device
Date: Tue, 06 Feb 2018 08:18:00 +0000 [thread overview]
Message-ID: <bug-198689-11613@https.bugzilla.kernel.org/> (raw)
https://bugzilla.kernel.org/show_bug.cgi?id=198689
Bug ID: 198689
Summary: Setro has no effect for SCSI device
Product: SCSI Drivers
Version: 2.5
Kernel Version: all
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: high
Priority: P1
Component: AACRAID
Assignee: scsi_drivers-aacraid@kernel-bugs.osdl.org
Reporter: yzlining@foxmail.com
Regression: No
Hi,
We found a problem when using SCSI device.
Setting the read-only attribute to scsi disk by calling "ioctl(fd, BLKROSET,
&ro)"
only block the first write operation.
In detail:
1: set ioctl(fd, BLKROSET, &ro)
2: dd to the block device(as /dev/sdc), write failed
3: dd to the block device again, write successed
Above operation can be reproduced by following script:
#! /bin/bash
DEV=$1
[[ "$DEV" =~ ^/dev/sd ]] || echo "Need a scsi device to reproduce"
blockdev --setro $DEV
echo $DEV getro is [ $(blockdev --getro $DEV) ]
dd if=/dev/zero of=$DEV count=1
echo $DEV getro is [ $(blockdev --getro $1) ]
dd if=/dev/zero of=$DEV count=1
Environment:
- Kernel: ALL
We reproduced this problem in following kernel version: 4.15 4.10, 3.10.
And by reference source, we think the problem exist in all versions.
- Driver: SCSI
it exists only when using SCSI disks, and xen-blk,virtio-blk do not have such
a
problem
Here is a test result:
# uname -r
4.15.0+
# ./reproduce.sh /dev/sda
/dev/sda getro is [ 1 ]
dd: writing to ‘/dev/sda’: Operation not permitted
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000258806 s, 0.0 kB/s
/dev/sda getro is [ 0 ]
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000321595 s, 1.6 MB/s
---
--
You are receiving this mail because:
You are watching the assignee of the bug.
next reply other threads:[~2018-02-06 8:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 8:18 bugzilla-daemon [this message]
2018-02-06 8:28 ` [Bug 198689] Setro has no effect for SCSI device bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-198689-11613@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@bugzilla.kernel.org \
--cc=linux-scsi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.