* [PATCH] target: Allow non-supporting backends to set pi_prot_type to 0
@ 2014-04-15 21:13 Andy Grover
2014-04-16 11:13 ` Sagi Grimberg
2014-04-18 0:14 ` Nicholas A. Bellinger
0 siblings, 2 replies; 4+ messages in thread
From: Andy Grover @ 2014-04-15 21:13 UTC (permalink / raw)
To: target-devel; +Cc: linux-scsi, frirajder
Userspace tools assume if a value is read from configfs, it is valid
and will not cause an error if the same value is written back. The only
valid value for pi_prot_type for backends not supporting DIF is 0, so allow
this particular value to be set without returning an error.
Reported-by: Krzysztof Chojnowski <frirajder@gmail.com>
Signed-off-by: Andy Grover <agrover@redhat.com>
---
drivers/target/target_core_device.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 65001e1..382b66b 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -936,6 +936,10 @@ int se_dev_set_pi_prot_type(struct se_device *dev, int flag)
return 0;
}
if (!dev->transport->init_prot || !dev->transport->free_prot) {
+ /* 0 is only allowed value for non-supporting backends */
+ if (flag == 0)
+ return 0;
+
pr_err("DIF protection not supported by backend: %s\n",
dev->transport->name);
return -ENOSYS;
--
1.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] target: Allow non-supporting backends to set pi_prot_type to 0
2014-04-15 21:13 [PATCH] target: Allow non-supporting backends to set pi_prot_type to 0 Andy Grover
@ 2014-04-16 11:13 ` Sagi Grimberg
2014-04-18 0:14 ` Nicholas A. Bellinger
1 sibling, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2014-04-16 11:13 UTC (permalink / raw)
To: Andy Grover, target-devel; +Cc: linux-scsi, frirajder
On 4/16/2014 12:13 AM, Andy Grover wrote:
> Userspace tools assume if a value is read from configfs, it is valid
> and will not cause an error if the same value is written back. The only
> valid value for pi_prot_type for backends not supporting DIF is 0, so allow
> this particular value to be set without returning an error.
>
> Reported-by: Krzysztof Chojnowski <frirajder@gmail.com>
> Signed-off-by: Andy Grover <agrover@redhat.com>
> ---
> drivers/target/target_core_device.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
> index 65001e1..382b66b 100644
> --- a/drivers/target/target_core_device.c
> +++ b/drivers/target/target_core_device.c
> @@ -936,6 +936,10 @@ int se_dev_set_pi_prot_type(struct se_device *dev, int flag)
> return 0;
> }
> if (!dev->transport->init_prot || !dev->transport->free_prot) {
> + /* 0 is only allowed value for non-supporting backends */
> + if (flag == 0)
> + return 0;
> +
> pr_err("DIF protection not supported by backend: %s\n",
> dev->transport->name);
> return -ENOSYS;
Makes sense.
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target: Allow non-supporting backends to set pi_prot_type to 0
2014-04-15 21:13 [PATCH] target: Allow non-supporting backends to set pi_prot_type to 0 Andy Grover
2014-04-16 11:13 ` Sagi Grimberg
@ 2014-04-18 0:14 ` Nicholas A. Bellinger
2014-04-18 14:25 ` Jerome Martin
1 sibling, 1 reply; 4+ messages in thread
From: Nicholas A. Bellinger @ 2014-04-18 0:14 UTC (permalink / raw)
To: Andy Grover; +Cc: target-devel, linux-scsi, frirajder
On Tue, 2014-04-15 at 14:13 -0700, Andy Grover wrote:
> Userspace tools assume if a value is read from configfs, it is valid
> and will not cause an error if the same value is written back. The only
> valid value for pi_prot_type for backends not supporting DIF is 0, so allow
> this particular value to be set without returning an error.
>
> Reported-by: Krzysztof Chojnowski <frirajder@gmail.com>
> Signed-off-by: Andy Grover <agrover@redhat.com>
> ---
> drivers/target/target_core_device.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
> index 65001e1..382b66b 100644
> --- a/drivers/target/target_core_device.c
> +++ b/drivers/target/target_core_device.c
> @@ -936,6 +936,10 @@ int se_dev_set_pi_prot_type(struct se_device *dev, int flag)
> return 0;
> }
> if (!dev->transport->init_prot || !dev->transport->free_prot) {
> + /* 0 is only allowed value for non-supporting backends */
> + if (flag == 0)
> + return 0;
> +
> pr_err("DIF protection not supported by backend: %s\n",
> dev->transport->name);
> return -ENOSYS;
Applied to target-pending/queue, and will merge into master as soon as
the rebase to v3.15-rc occurs.
Thanks!
--nab
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target: Allow non-supporting backends to set pi_prot_type to 0
2014-04-18 0:14 ` Nicholas A. Bellinger
@ 2014-04-18 14:25 ` Jerome Martin
0 siblings, 0 replies; 4+ messages in thread
From: Jerome Martin @ 2014-04-18 14:25 UTC (permalink / raw)
To: Nicholas A. Bellinger, Andy Grover; +Cc: target-devel, linux-scsi, frirajder
Excellent, thank you Nic and Andy, that will fix the issue with
rtslib/targetcli main branch too.
On 04/18/2014 02:14 AM, Nicholas A. Bellinger wrote:
> On Tue, 2014-04-15 at 14:13 -0700, Andy Grover wrote:
>> Userspace tools assume if a value is read from configfs, it is valid
>> and will not cause an error if the same value is written back. The only
>> valid value for pi_prot_type for backends not supporting DIF is 0, so allow
>> this particular value to be set without returning an error.
>>
>> Reported-by: Krzysztof Chojnowski <frirajder@gmail.com>
>> Signed-off-by: Andy Grover <agrover@redhat.com>
>> ---
>> drivers/target/target_core_device.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
>> index 65001e1..382b66b 100644
>> --- a/drivers/target/target_core_device.c
>> +++ b/drivers/target/target_core_device.c
>> @@ -936,6 +936,10 @@ int se_dev_set_pi_prot_type(struct se_device *dev, int flag)
>> return 0;
>> }
>> if (!dev->transport->init_prot || !dev->transport->free_prot) {
>> + /* 0 is only allowed value for non-supporting backends */
>> + if (flag == 0)
>> + return 0;
>> +
>> pr_err("DIF protection not supported by backend: %s\n",
>> dev->transport->name);
>> return -ENOSYS;
>
> Applied to target-pending/queue, and will merge into master as soon as
> the rebase to v3.15-rc occurs.
>
> Thanks!
>
> --nab
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe target-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-18 14:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 21:13 [PATCH] target: Allow non-supporting backends to set pi_prot_type to 0 Andy Grover
2014-04-16 11:13 ` Sagi Grimberg
2014-04-18 0:14 ` Nicholas A. Bellinger
2014-04-18 14:25 ` Jerome Martin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.