public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Keith Busch <kbusch@kernel.org>
Cc: Keith Busch <keith.busch@wdc.com>, Christoph Hellwig <hch@lst.de>,
	linux-nvme@lists.infradead.org, Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [PATCH] nvme: add 'fail_if_no_path' sysfs attribute
Date: Sat, 20 Feb 2021 15:58:32 +0100	[thread overview]
Message-ID: <2d069bdb-d4dc-9d50-075f-1fa7eb6bc949@suse.de> (raw)
In-Reply-To: <20210219231643.GA4105@redsun51.ssa.fujisawa.hgst.com>

On 2/20/21 12:16 AM, Keith Busch wrote:
> On Fri, Feb 19, 2021 at 03:46:25PM +0100, Hannes Reinecke wrote:
>> In some setups like RAID we need to return an I/O error
>> once all paths are unavailable to allow the upper layers
>> to start their own error recovery (like redirecting I/O
>> to other mirrors).
>> This patch adds a sysfs attribute 'fail_if_no_path' to
>> allow the admin to enable that behaviour instead of the
>> current 'queue until a path becomes available' policy.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
> 
> Sounds okay to me, just some minor nits below.
> 
>> @@ -283,10 +283,13 @@ static bool nvme_available_path(struct nvme_ns_head *head)
>>   			continue;
>>   		switch (ns->ctrl->state) {
>>   		case NVME_CTRL_LIVE:
>> +			return true;
>>   		case NVME_CTRL_RESETTING:
>>   		case NVME_CTRL_CONNECTING:
>>   			/* fallthru */
>> -			return true;
>> +			if (!test_bit(NVME_NSHEAD_FAIL_IF_NO_PATH,
>> +				      &head->flags))
>> +				return true;
> 
> It doesn't look like the 'fallthru' is in the right place anymore,
> though I can't tell why it is there in the first place.
> 
Indeed, the 'fallthru' is misplaced; it needs to go after
NVME_CTRL_RESETTING.

>>   		default:
>>   			break;
>>   		}
>> @@ -641,6 +644,37 @@ static ssize_t ana_state_show(struct device *dev, struct device_attribute *attr,
>>   }
>>   DEVICE_ATTR_RO(ana_state);
>>   
>> +static ssize_t fail_if_no_path_show(struct device *dev,
>> +		struct device_attribute *attr, char *buf)
>> +{
>> +	struct gendisk *disk = dev_to_disk(dev);
>> +	struct nvme_ns_head *head = disk->private_data;
>> +
>> +	return sprintf(buf, "%d\n",
>> +		       test_bit(NVME_NSHEAD_FAIL_IF_NO_PATH, &head->flags) ?
>> +		       1 : 0);
>> +}
>> +
>> +static ssize_t fail_if_no_path_store(struct device *dev,
>> +		struct device_attribute *attr, const char *buf, size_t count)
>> +{
>> +	struct gendisk *disk = dev_to_disk(dev);
>> +	struct nvme_ns_head *head = disk->private_data;
>> +	int fail_if_no_path, err;
>> +
>> +	err = kstrtoint(buf, 10, &fail_if_no_path);
>> +	if (err)
>> +		return -EINVAL;
>> +
>> +	else if (fail_if_no_path <= 0)
>> +		clear_bit(NVME_NSHEAD_FAIL_IF_NO_PATH, &head->flags);
>> +	else
>> +		set_bit(NVME_NSHEAD_FAIL_IF_NO_PATH, &head->flags);
> 
> The extra line above the 'else if' should be removed, or just change it
> to simply 'if'.
> 
Sure.

I'll be resending.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

      reply	other threads:[~2021-02-20 14:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 14:46 [PATCH] nvme: add 'fail_if_no_path' sysfs attribute Hannes Reinecke
2021-02-19 23:16 ` Keith Busch
2021-02-20 14:58   ` Hannes Reinecke [this message]

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=2d069bdb-d4dc-9d50-075f-1fa7eb6bc949@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=keith.busch@wdc.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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