targetctl restore and OSError: [Errno 22] Invalid argument

Andy Grover agrover at redhat.com
Tue Apr 15 17:44:02 UTC 2014


On 04/14/2014 06:05 AM, Krzysztof Chojnowski wrote:
> Hi,
>
> I'm testing targetcli-fb on my Archlinux box and restore functionality
> is failing with following:
>
> # /usr/bin/targetctl restore
> OSError: [Errno 22] Invalid argument
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>    File "/usr/lib/python3.4/site-packages/rtslib/node.py", line 140, in
> set_attribute
>      fwrite(path, "%s" % str(value))
>    File "/usr/lib/python3.4/site-packages/rtslib/utils.py", line 67, in
> fwrite
>      file_fd.write(str(string))
> OSError: [Errno 22] Invalid argument
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>    File "/usr/bin/targetctl", line 87, in <module>
>      main()
>    File "/usr/bin/targetctl", line 84, in main
>      funcs[sys.argv[1]](savefile)
>    File "/usr/bin/targetctl", line 47, in restore
>      errors = RTSRoot().restore_from_file(restore_file=from_file)
>    File "/usr/lib/python3.4/site-packages/rtslib/root.py", line 260, in
> restore_from_file
>      abort_on_error=abort_on_error)
>    File "/usr/lib/python3.4/site-packages/rtslib/root.py", line 201, in
> restore
>      set_attributes(so_obj, so.get('attributes', {}))
>    File "/usr/lib/python3.4/site-packages/rtslib/utils.py", line 440, in
> set_attributes
>      obj.set_attribute(name, value)
>    File "/usr/lib/python3.4/site-packages/rtslib/node.py", line 142, in
> set_attribute
>      msg = msg[1]
> TypeError: 'OSError' object is not subscriptable
>
>
> I debugged it to following file and value:
>
> # echo 0 >
> /sys/kernel/config/target/core/iblock_0/windows_data/attrib/pi_prot_type
> bash: echo: write error: Invalid argument
>
> Dmesg logs following:
> [168897.460098] DIF protection not supported by backend: iblock
>
> Is it kernel or targetcli-fb issue?

Thanks for your investigation.

It is both.

There's some questionable exception-catching code in rtslib-fb (the 
library targetcli-fb uses) and then in the kernel -- userspace expects 
to be able to always set attributes to the value we read (and saved) but 
this is not the case for the new pi_prot_type attribute.

I'll fix up rtslib-fb and hopefully post the trivial fix for the kernel 
today, as well.

Regards -- Andy



More information about the targetcli-fb-devel mailing list