Bug 1667505

Summary: Permission denied: '/sys/kernel/config/target/core/fileio_.../xxx/attrib/pi_prot_format'
Product: [Fedora] Fedora Reporter: Tomáš Bžatek <tbzatek>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: airlied, bskeggs, hdegoede, ichavero, itamar, jarodwilson, jeremy, jglisse, john.j5live, jonathan, josef, kernel-maint, linville, mchehab, mjg59, mlombard, openstack, steved, vtrefny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 Tomáš Bžatek 2019-01-18 16:11:29 UTC
targetcli-2.1.fb49-1.fc30.noarch
kernel-5.0.0-0.rc2.git2.1.fc30.x86_64

How reproducible:
always

Steps to Reproduce:
1. # truncate -s 1G /tmp/xxx
2. # targetcli /backstores/fileio/ create xxx /tmp/xxx
Created fileio xxx with size 1073741824
3. # targetcli /backstores/fileio/xxx info 
[Errno 13] Permission denied: '/sys/kernel/config/target/core/fileio_28/xxx/attrib/pi_prot_format'


Also getting nice Python traceback when running targetcli interactively:

# targetcli 
> targetcli shell version 2.1.fb49
> Copyright 2011-2013 by Datera, Inc and others.
> For help on commands, type 'help'.
> 
>  /> /backstores/fileio/xxx info
> Traceback (most recent call last):
>   File "/usr/bin/targetcli", line 122, in <module>
>     main()
>   File "/usr/bin/targetcli", line 112, in main
>     shell.run_interactive()
>   File "/usr/lib/python3.7/site-packages/configshell_fb/shell.py", line 905, in run_interactive
>     self._cli_loop()
>   File "/usr/lib/python3.7/site-packages/configshell_fb/shell.py", line 734, in _cli_loop
>     self.run_cmdline(cmdline)
>   File "/usr/lib/python3.7/site-packages/configshell_fb/shell.py", line 848, in run_cmdline
>     self._execute_command(path, command, pparams, kparams)
>   File "/usr/lib/python3.7/site-packages/configshell_fb/shell.py", line 823, in _execute_command
>     result = target.execute_command(command, pparams, kparams)
>   File "/usr/lib/python3.7/site-packages/configshell_fb/node.py", line 1406, in execute_command
>     return method(*pparams, **kparams)
>   File "/usr/lib/python3.7/site-packages/targetcli/ui_node.py", line 207, in ui_command_info
>     info = self.rtsnode.dump()
>   File "/usr/lib/python3.7/site-packages/rtslib_fb/tcm.py", line 693, in dump
>     d = super(FileIOStorageObject, self).dump()
>   File "/usr/lib/python3.7/site-packages/rtslib_fb/tcm.py", line 314, in dump
>     d = super(StorageObject, self).dump()
>   File "/usr/lib/python3.7/site-packages/rtslib_fb/node.py", line 225, in dump
>     attrs[item] = int(self.get_attribute(item))
>   File "/usr/lib/python3.7/site-packages/rtslib_fb/node.py", line 168, in get_attribute
>     return fread(path)
>   File "/usr/lib/python3.7/site-packages/rtslib_fb/utils.py", line 100, in fread
>     with open(path, 'r') as file_fd:
> PermissionError: [Errno 13] Permission denied: '/sys/kernel/config/target/core/fileio_28/xxx/attrib/pi_prot_format'


Additional info:
Not necessarily targetcli bug in its nature, filing for consideration and better error handling.

Comment 1 Tomáš Bžatek 2019-01-18 16:21:56 UTC
Works fine with kernel-4.20.3-200.fc29

Comment 2 openstack team 2019-02-03 13:48:43 UTC
failed since kernel-5.x.x, issue reproduced also with kernel-5.0.0-0.rc4.git3.1.fc30

Comment 3 Laura Abbott 2019-02-03 16:50:28 UTC
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6baca7601bdee2e57f20c45d63eb53b89b33e816 Looks like this was changed to write-only intentionally and the code is opening with read. This is a userspace regression so I can see about getting this reverted but it also sounds like this should be fixed in targetcli as well.

Comment 4 Maurizio Lombardi 2019-02-07 15:16:43 UTC
This is going to be fixed in kernel 5.0

https://marc.info/?l=target-devel&m=154930519830248&w=2