All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linda Knippers <ljklists@gmail.com>
To: "Verma, Vishal L" <vishal.l.verma@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH v3 6/7] ndctl: add a BTT check utility
Date: Tue, 14 Mar 2017 15:52:25 -0400	[thread overview]
Message-ID: <58C849F9.3060106@gmail.com> (raw)
In-Reply-To: <1489519422.2541.2.camel@intel.com>

On 3/14/2017 3:23 PM, Verma, Vishal L wrote:
> On Mon, 2017-03-13 at 19:26 -0400, Linda Knippers wrote:
>> Hi Vishal,
>>
>> Thanks for all your work on this.  I finally got a chance to do some
>> testing and have a few usability suggestions for you to consider.
>
> Thanks for the comments, Linda. See below, but yes I can send follow on
> patches for these.

Great, later is fine.  More below.
>
>>
>> On 03/04/2017 01:13 AM, Vishal Verma wrote:
>> <snip>
>>>
>>> */
>>> +	raw_mode = ndctl_namespace_get_raw_mode(ndns);
>>> +
>>> +	/*
>>> +	 * Putting the namespace into raw mode will allow us to
>>> access
>>> +	 * the btt metadata.
>>> +	 */
>>> +	rc = ndctl_namespace_set_raw_mode(ndns, 1);
>>> +	if (rc < 0) {
>>> +		err(bttc, "%s: failed to set the raw mode flag:
>>> %d\n",
>>> +			devname, rc);
>>> +		goto out_ns;
>>> +	}
>>
>> When I ran the utility as non-root, I got this:
>> $ ndctl check-namespace namespace3.0
>> namespace3.0: namespace_check: namespace3.0: failed to set the raw
>> mode flag: -6
>> error checking namespaces: No such device or address
>>
>> I think it ought to end with Permission denied, which it would do if
>> ndctl_namespace_get_raw_mode() returned with -errno rather than a
>> hard
>> coded ENXIO.
>
> Good point - I'll fix this (in a follow on patch).
>
>>
>> If that's main reason that setting the raw mode flag can fail, then
>> the
>> err() could be an info().  That would simplify the output.
>
> I think it should still be an error as it is a fatal problem and we
> have to abort..

It's just a bit confusing when the most likely cause is not running
as root.  Otherwise, that error probably can't really happen.
In other places you don't even check the return value for the function,
probably because it doesn't really happen.

>
> <snip>
>
>>> +
>>> +	rc = btt_info_read_verify(bttc, btt_sb, bttc->start_off);
>>> +	if (rc) {
>>> +		rc = btt_recover_first_sb(bttc);
>>> +		if (rc) {
>>> +			info(bttc, "Unable to recover any BTT info
>>> blocks\n");
>>> +			goto out_close;
>>
>> When I ran this on a namespace that never had a BTT, I thought I'd
>> get a error
>> basically saying that I'm screwed, but instead I got:
>>
>> $ sudo ndctl check-namespace namespace1.0
>> error checking namespaces: No such device or address
>>
>> It seems like the info() above is rather important and should be an
>> err().
>> For a checker, maybe verbose should be the default anyway.
>
> Ok - let me revisit the no BTT case and see if we can print out
> something better.

The message that you have there is probably good enough, it just
didn't come out without the verbose option.  The "No such device or address"
part is a bit wrong though because the device is there, there's just
no btt on it.
>
>>
>>> +		}
>>> +		rc = btt_info_read_verify(bttc, btt_sb, bttc-
>>>> start_off);
>>> +		if (rc)
>>> +			goto out_close;
>>> +	}
>>> +	rc = btt_discover_arenas(bttc);
>>> +	if (rc)
>>> +		goto out_close;
>>> +
>>> +	rc = btt_create_mappings(bttc);
>>> +	if (rc)
>>> +		goto out_close;
>>> +
>>> +	rc = btt_check_arenas(bttc);
>>> +
>>> +	btt_remove_mappings(bttc);
>>> + out_close:
>>> +	close(bttc->fd);
>>> + out_sb:
>>> +	free(btt_sb);
>>> + out_ns:
>>> +	ndctl_namespace_set_raw_mode(ndns, raw_mode);
>>> +	ndctl_namespace_disable_invalidate(ndns);
>>> +	if (disabled_flag)
>>> +		if(ndctl_namespace_enable(ndns) < 0)
>>> +			info(bttc, "%s: failed to re-enable
>>> namespace\n",
>>> +				devname);
>>
>> I didn't get this error but it seems rather important too.
>
> This should normally never happen, and I had it as an info because at
> this point we can't really do anything about it. Any check/repair has
> already completed, and if we weren't able to enable the namespace, the
> user likely won't either for the same reason.. In any case, it seems
> more like an informational message since nothing can be done about it,
> and it doesn't affect any future flow..

The reason I think it should be an error is that something went wrong,
whether you can do anything about it in the checker or not.  Without an
error the user will have no idea because the function returns successfully.
That's actually true for the two ndctl_namespace...() functions above where
the return value isn't even checked.  If the namespace is left in an
unclean state or unusable state, that would be good to know before the user
attempts to use the namespace and gets some other error.

For something like a checker, more information is better, which contradicts
my first comment. :-)

-- ljk
>
>>
>> Thanks,
>>
>> - ljk
>>
>>> + out_bttc:
>>> +	free(bttc);
>>> +	return rc;
>>> +}
>>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-03-14 19:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04  6:13 [ndctl PATCH v3 0/7] Add ndctl check-namespace Vishal Verma
2017-03-04  6:13 ` [ndctl PATCH v3 1/7] libndctl: add a ndctl_namespace_is_active helper Vishal Verma
2017-03-04  6:13 ` [ndctl PATCH v3 2/7] libndctl: add a ndctl_namespace_disable_safe() API Vishal Verma
2017-03-04  6:13 ` [ndctl PATCH v3 3/7] ccan: Add ccan/bitmap in preparation for the BTT checker Vishal Verma
2017-04-01 15:53   ` Dan Williams
2017-03-04  6:13 ` [ndctl PATCH v3 4/7] ccan/bitmap: fix a set of gcc warnings (with -Wshadow) Vishal Verma
2017-03-04  6:13 ` [ndctl PATCH v3 5/7] ndctl: move the fletcher64 routine to util/ Vishal Verma
2017-03-04  6:13 ` [ndctl PATCH v3 6/7] ndctl: add a BTT check utility Vishal Verma
2017-03-13 23:26   ` Linda Knippers
2017-03-14 19:23     ` Verma, Vishal L
2017-03-14 19:52       ` Linda Knippers [this message]
2017-03-04  6:13 ` [ndctl PATCH v3 7/7] ndctl, test: Add a unit test for the BTT checker Vishal Verma

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=58C849F9.3060106@gmail.com \
    --to=ljklists@gmail.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vishal.l.verma@intel.com \
    /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 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.