[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <175957657719.1793333.15585390544259019306@noble.neil.brown.name>
Date: Sat, 04 Oct 2025 21:16:17 +1000
From: NeilBrown <neilb@...mail.net>
To: "Markus Elfring" <Markus.Elfring@....de>
Cc: linux-cifs@...r.kernel.org, "LKML" <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org, "Namjae Jeon" <linkinjeon@...nel.org>,
"Sergey Senozhatsky" <senozhatsky@...omium.org>,
"Stefan Metzmacher" <metze@...ba.org>, "Steve French" <smfrench@...il.com>,
"Tom Talpey" <tom@...pey.com>
Subject: Re: ksmbd: Use common error handling code in ksmbd_vfs_path_lookup()
On Sat, 04 Oct 2025, Markus Elfring wrote:
> …> - declare struct path path __free(path_-put) = {};
> …> return_path->dentry = no_free_ptr(path.dentry);
> > return_path->mnt = no_free_ptr(path.mnt);
> > return 0;
> >
> > This is based on the pattern in kern_path_parent() and
> > __start_removing_path().
>
> Do you propose that affected software components may benefit more from
> the application of scope-based resource management?
> https://elixir.bootlin.com/linux/v6.17/source/include/linux/path.h#L22-L28
Exactly. It doesn't suit every case, but if you are going to make
changes to the exit paths of a function, I think it is worth
considering if scope-based code will work well for the particular
function.
Since v6.17 there has already been a net increase of 167 uses of __free
(though some might be in comments....) and 1902 more uses for guard().
So at least some people think it is a good idea.
NeilBrown
Powered by blists - more mailing lists