All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: dm-devel@redhat.com
Subject: Re: [PATCH v2 2/2] multipathd: skip spurious event message for blacklisted paths
Date: Wed, 14 Dec 2016 13:53:09 +0100	[thread overview]
Message-ID: <1481719989.23867.5.camel@suse.com> (raw)
In-Reply-To: <20161213215024.GB19659@octiron.msp.redhat.com>

On Tue, 2016-12-13 at 15:50 -0600, Benjamin Marzinski wrote:

> On Tue, Dec 13, 2016 at 04:27:09PM -0200, Mauricio Faria de Oliveira
> wrote:
> When you call alloc_path_with_pathinfo(), it already grabs the second
> reference before calling pathinfo. When it exits without pp_ptr being
> set, it frees that extra reference in free_path(). But this whole
> time,
> we are still servicing the uevent, and that originl reference is
> always
> held, so we don't ever need to worry about the udevice getting
> deleted
> out from under us. I don't see any possible danger in removing the
> udev_device_ref/unref calls from your code. They don't hurt anything,
> but grabbing references when we don't need them just confuses other
> people who are trying reading the code, and makes the purpose of the
> references harder to understand.

As someone who has just recently started reading the multipath-tools
code in depth, I tend to disagree. Someone reading the function
including the udev_device_ref()/unref() calls would see that the device
references are handled correctly in the function itself, without having
to know or having to track down how the device references are created
and dropped in other parts of the code. Moreover, if the global ref
handling was ever to be changed in the future, this function would
still be "safe".

If the udev_device_ref/unref calls are removed, at least a comment
explaining why they aren't needed would help new readers of the code.

Regards
Martin

-- 
Dr. Martin Wilck <mwilck@suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

  parent reply	other threads:[~2016-12-14 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13 18:27 [PATCH v2 1/2] libmultipath: prevent memory leak in alloc_path_with_pathinfo() if pp_ptr is NULL Mauricio Faria de Oliveira
2016-12-13 18:27 ` [PATCH v2 2/2] multipathd: skip spurious event message for blacklisted paths Mauricio Faria de Oliveira
2016-12-13 21:50   ` Benjamin Marzinski
2016-12-13 23:53     ` Mauricio Faria de Oliveira
2016-12-14 12:53     ` Martin Wilck [this message]
2016-12-20 17:00       ` Benjamin Marzinski

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=1481719989.23867.5.camel@suse.com \
    --to=mwilck@suse.com \
    --cc=dm-devel@redhat.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.