Package: blktool
Version: 4-6
Severity: normal

blktool can't set devices readonly because it doesn't pass the right
parameters to the ioctl.

Set up a test device:

  $ echo hello > /tmp/foo
  $ sudo losetup /dev/loop7 /tmp/foo

Test read-only status with two tools:

  $ sudo blktool /dev/loop7 readonly
  off
  $ sudo blockdev --getro /dev/loop7
  0

Try setting read-only with blktool -- this fails:
  
  $ sudo blktool /dev/loop7 readonly on
  BLKROSET: Bad address
  $ sudo blktool /dev/loop7 readonly
  off
  $ sudo blockdev --getro /dev/loop7
  0
  
Try setting read-only with blockdev -- this works:

  $ sudo blockdev --setro /dev/loop7
  $ sudo blktool /dev/loop7 readonly
  on
  $ sudo blockdev --getro /dev/loop7
  1

See the difference for why blktool fails and why blockdev succeeds:

  $ sudo strace -e ioctl blktool /dev/loop7 readonly on
  ioctl(3, BLKROSET, 0x1)                 = -1 EFAULT (Bad address)
  BLKROSET: Bad address
  $ sudo strace -e ioctl blockdev --setro /dev/loop7
  ioctl(3, BLKROSET, 0x7fff1cd4ea98)      = 0


-jim

-- System Information:
Debian Release: 6.0
  APT prefers testing
  APT policy: (300, 'testing'), (50, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages blktool depends on:
ii  libc6                         2.11.2-10  Embedded GNU C Library: Shared lib
ii  libglib2.0-0                  2.28.6-1   The GLib library of C routines

blktool recommends no packages.

blktool suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to