Bug 818855

Summary: can't create block backstore with readonly software RAID
Product: [Fedora] Fedora Reporter: Albert Strasheim <fullung>
Component: targetcliAssignee: Andy Grover <agrover>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 16CC: agrover
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-07 23:15:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Albert Strasheim 2012-05-04 08:20:03 UTC
Description of problem:

I have a software RAID volume md0.

I made it read-only with mdadm --readonly /dev/md0.

I create a block backstore with this software RAID device in targetcli.

I get a Permission denied error.

Version-Release number of selected component (if applicable):

kernel 3.3.2-6.fc16.x86_64

targetcli version reports 2.0rc1.fb8 but actually I have fb11. I notice that the package has:

/usr/lib/python2.7/site-packages/targetcli-2.0rc1.fb8-py2.7.egg-info

but also

/usr/share/doc/targetcli-2.0rc1.fb11/README

How reproducible:

Always

Actual results:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 990, in run_interactive
    self._cli_loop()
  File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 813, in _cli_loop
    self.run_cmdline(cmdline)
  File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 934, in run_cmdline
    self._execute_command(path, command, pparams, kparams)
  File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 909, in _execute_command
    result = target.execute_command(command, pparams, kparams)
  File "/usr/lib/python2.7/site-packages/targetcli/ui_node.py", line 84, in execute_command
    pparams, kparams)
  File "/usr/lib/python2.7/site-packages/configshell/node.py", line 1405, in execute_command
    result = method(*pparams, **kparams)
  File "/usr/lib/python2.7/site-packages/targetcli/ui_backstore.py", line 340, in ui_command_create
    raise exception
IOError: [Errno 13] Permission denied

Additional info:

I straced targetcli during this problem:

20102 lstat("/sys/kernel/config/target/core/iblock_1/md0", {st_dev=makedev(0, 31), st_ino=68803, st_mode=S_IFDIR|0755, st_nlink=7, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=0, st_atime=2012/05/04-08:12:22, st_mtime=2012/05/04-08:12:23, st_ctime=2012/05/04-08:12:23}) = 0
20102 lstat("/sys/kernel/config/target/core/iblock_1/md0/enable", {st_dev=makedev(0, 31), st_ino=35738, st_mode=S_IFREG|0200, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=4096, st_atime=2012/05/04-08:12:23, st_mtime=2012/05/04-08:12:23, st_ctime=2012/05/04-08:12:23}) = 0
20102 open("/sys/kernel/config/target/core/iblock_1/md0/enable", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
20102 fstat(4, {st_dev=makedev(0, 31), st_ino=35739, st_mode=S_IFREG|0200, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=0, st_atime=2012/05/04-08:12:23, st_mtime=2012/05/04-08:12:23, st_ctime=2012/05/04-08:12:23}) = 0
20102 fstat(4, {st_dev=makedev(0, 31), st_ino=35739, st_mode=S_IFREG|0200, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=0, st_atime=2012/05/04-08:12:23, st_mtime=2012/05/04-08:12:23, st_ctime=2012/05/04-08:12:23}) = 0
20102 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7faacb2e5000
20102 write(4, "1\n", 2)                = -1 EACCES (Permission denied)
20102 close(4)                          = 0

Comment 1 Andy Grover 2012-06-07 15:55:52 UTC
Can reproduce.

Comment 2 Andy Grover 2012-08-07 23:15:42 UTC
Should be fixed in rawhide. Requires kernel 3.6.0, so can't backport to F17 (or F16) until they get that kernel.

Comment 3 Albert Strasheim 2012-08-08 06:25:44 UTC
Thanks very much. For my own education, do you have the upstream commit hashes handy?

Comment 4 Andy Grover 2012-08-08 18:58:30 UTC
kernel: 44bfd0185043c9a92b2f20a4508dd6cd3bb84ded

rtslib-fb (git://github.com/agrover/rtslib-fb.git):
d7b27b5e3085da5ca89a43b0fdd07340b0d9a118
70175a39fee2419c49a19f70a61f536afb829a15

targetcli-fb (git://github.com/agrover/targetcli-fb.git):
05c8513f21ffbda26f8e1741068971ab22d0454c