read call encounters EIO in accessing raw device.

Solution Unverified - Updated -

Issue

  • EIO(Input/output error) occurs when read call cannot read the specified size in accessing raw device. This behavior of raw device changes by kernel version.
  • EIO occurs on a raw device with kernel-2.6.32-431.el6 while EIO does not occur with kernel-2.6.32-358.23.2.el6.

  • a part of strace of 2.6.32-431.el6. read call completes 3 times. 4th read encounters EIO.

# strace -f dd if=/dev/raw/raw1 of=/dev/null bs=1M
...
mmap(NULL, 1060864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f54bb2db000
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
read(0, 0x7f54bb2dc000, 1048576)  = -1 EIO (Input/output error)
  • a part of strace of 2.6.32-358.23.2.el6. read call completes 4 times.
# strace -f dd if=/dev/raw/raw1 of=/dev/null bs=1M
...
mmap(NULL, 1060864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8fac61c000
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 980992
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 980992) = 980992
read(0, "", 1048576)              = 0
  • Reading of a raw device fails at the end of the device with RHEL6.5 kernel, while previous kernel succeeds without issue
 -- 2.6.32-431.el6 --
 # dd if=/dev/raw/raw1 of=/dev/null bs=1M
 dd: reading `/dev/raw/raw1': Input/output error
 3+0 records in
 3+0 records out
 3145728 bytes (3.1 MB) copied, 0.0102012 s, 308 MB/s

 -- 2.6.32-358.23.2.el6 --
 # dd if=/dev/raw/raw1 of=/dev/null bs=1M
 3+1 records in
 3+1 records out
 4126720 bytes (4.1 MB) copied, 0.124816 s, 33.1 MB/s

Environment

  • Red Hat Enterprise Linux 6.5
  • kernel-2.6.32-431.el6.x86_64
  • Red Hat Enterprise Linux 7
  • raw device

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content