lkml.org 
[lkml]   [2022]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 04/06] 9p fid refcount: add p9_fid_get/put wrappers
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

\
 
 \ /
  Last update: 2022-06-15 15:50    [W:0.070 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site