From: Dominique Martinet <asmadeus@codewreck.org>
To: Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>,
Latchesar Ionkov <lucho@ionkov.net>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Tyler Hicks <tyhicks@linux.microsoft.com>,
v9fs-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v3 04/06] 9p fid refcount: add p9_fid_get/put wrappers
Date: Wed, 15 Jun 2022 22:47:05 +0900 [thread overview]
Message-ID: <Yqni2QQg0uX9Lx13@codewreck.org> (raw)
In-Reply-To: <21498866.auqpVWlHDa@silver>
Christian Schoenebeck wrote on Wed, Jun 15, 2022 at 03:00:19PM +0200:
> > - if (!fid || IS_ERR(fid)) {
> > - pr_warn("%s (%d): Trying to clunk with invalid fid\n",
> > - __func__, task_pid_nr(current));
> > - dump_stack();
> > - return 0;
> > - }
> > - if (!refcount_dec_and_test(&fid->count))
> > - return 0;
> > -
>
> I probably would have moved (and that way preserved) that sanity warning to
> p9_fid_put(), but anyway LGTM.
The existing code was careful not to call clunk on error, but I consider
put() calls to be kind of like free in that it's better to make these
easy to call: this allowed patch 6 reworked most fs/ functions getting a
ref to just initialize fids to NULL and inconditionally call
p9_fid_put() before return.
I guess it's just a matter of preference ultimately, but I think that'll
make it a bit easier to not leak fids. Time will tell if this works :)
> Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Thanks for this and other reviews!
--
Dominique
next prev parent reply other threads:[~2022-06-15 13:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220612085330.1451496-1-asmadeus@codewreck.org>
2022-06-12 8:53 ` [PATCH 04/06] 9p fid refcount: add p9_fid_get/put wrappers Dominique Martinet
2022-06-12 23:45 ` [PATCH v2 " Dominique Martinet
2022-06-13 17:31 ` Tyler Hicks
2022-06-14 13:55 ` Christian Schoenebeck
2022-06-14 14:27 ` Dominique Martinet
2022-06-15 3:16 ` [PATCH v3 " Dominique Martinet
2022-06-15 13:00 ` Christian Schoenebeck
2022-06-15 13:47 ` Dominique Martinet [this message]
2022-06-12 8:53 ` [PATCH 05/06] 9p fid refcount: add a 9p_fid_ref tracepoint Dominique Martinet
2022-06-12 22:46 ` Steven Rostedt
2022-06-12 23:46 ` [PATCH v2 " Dominique Martinet
2022-06-13 7:00 ` Dominique Martinet
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=Yqni2QQg0uX9Lx13@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=davem@davemloft.net \
--cc=ericvh@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tyhicks@linux.microsoft.com \
--cc=v9fs-developer@lists.sourceforge.net \
/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).