From: Christoph Hellwig <hch@lst.de>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Hannes Reinecke <hare@suse.de>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Christoph Hellwig <hch@lst.de>, Ewan Milne <emilne@redhat.com>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH] libfc: unsafe refcounting in fc_rport_work()
Date: Wed, 20 Apr 2016 21:19:18 +0200 [thread overview]
Message-ID: <20160420191918.GA28741@lst.de> (raw)
In-Reply-To: <1461178992.14609.12.camel@HansenPartnership.com>
On Wed, Apr 20, 2016 at 03:03:12PM -0400, James Bottomley wrote:
> Plus, kref_get_unless_zero() should not be used. At that point, the
> structure would be freed, so there's no point looking for it.
Agreed for this particular case. Note that the whole code seems rather
whckay as it uses a rport_destroy method that just has one instance,
so I'd really like to see things cleaned up to remove this method
and add a warapper for the kref_put before doing further changes.
> kref_get_unless_zero is for refcounts that don't necessarily free the
> structure (embedded ones).
The main case actually is for embedded krefs. The important bit is that
the structure is on some lookup data structure (typically list), and
kref_get_unless_zero protects against the window from between dropping
the last references and doing the list removal in the destructor.
next prev parent reply other threads:[~2016-04-20 19:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 13:24 [PATCH] libfc: unsafe refcounting in fc_rport_work() Hannes Reinecke
2016-04-20 14:17 ` Johannes Thumshirn
2016-04-20 19:03 ` James Bottomley
2016-04-20 19:19 ` Christoph Hellwig [this message]
2016-04-21 2:25 ` Ewan Milne
2016-04-21 20:11 ` James Bottomley
2016-04-21 12:39 ` Johannes Thumshirn
2016-04-25 8:01 ` Hannes Reinecke
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=20160420191918.GA28741@lst.de \
--to=hch@lst.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=emilne@redhat.com \
--cc=hare@suse.de \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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.