linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagig@dev.mellanox.co.il>
To: Andy Grover <agrover@redhat.com>, target-devel@vger.kernel.org
Cc: linux-scsi@vger.kernel.org, frirajder@gmail.com
Subject: Re: [PATCH] target: Allow non-supporting backends to set pi_prot_type to 0
Date: Wed, 16 Apr 2014 14:13:18 +0300	[thread overview]
Message-ID: <534E65CE.8080903@dev.mellanox.co.il> (raw)
In-Reply-To: <1397596392-32552-1-git-send-email-agrover@redhat.com>

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>

  reply	other threads:[~2014-04-16 11:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-04-18  0:14 ` Nicholas A. Bellinger
2014-04-18 14:25   ` Jerome Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534E65CE.8080903@dev.mellanox.co.il \
    --to=sagig@dev.mellanox.co.il \
    --cc=agrover@redhat.com \
    --cc=frirajder@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).