On 9/3/21 7:48 AM, Maurizio Lombardi wrote: > Commit 356ba2a8bc8d ("scsi: target: tcmu: Make pgr_support and > alua_support attributes writable") > introduced support for changeable alua_support and pgr_support > target attributes. They can only be changed > if the backstore is user-backed, otherwise the kernel returns -EINVAL. > > This caused a regression in targetcli/rtslib because now a warning > is triggered when performing a target restore that includes > non-userbacked backstores, even if rtslib is not trying to change > the attributes' values: > > $ targetctl restore > Storage Object block/storage1: Cannot set attribute alua_support: > [Errno 22] Invalid argument, skipped > Storage Object block/storage1: Cannot set attribute pgr_support: > [Errno 22] Invalid argument, skipped > > Fix this warning by returning an error only if we are really > going to flip the PGR/ALUA bit in the transport_flags field, > otherwise we'll do nothing and return success. > > Return EOPNOTSUPP instead of EINVAL if the pgr/alua attributes > can't be changed, this way it'll be possible for userspace to understand > if the operation failed because an invalid value has been passed > to strtobool() or because the attributes are fixed. Maybe you want to use -ENOSYS. Other lio sysfs files return that when the operation is not supported. You could then handle all the warnings with the same check.