From: NeilBrown <neilb@ownmail.net>
To: "Markus Elfring" <Markus.Elfring@web.de>
Cc: linux-cifs@vger.kernel.org, "LKML" <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
"Namjae Jeon" <linkinjeon@kernel.org>,
"Sergey Senozhatsky" <senozhatsky@chromium.org>,
"Stefan Metzmacher" <metze@samba.org>,
"Steve French" <smfrench@gmail.com>,
"Tom Talpey" <tom@talpey.com>
Subject: Re: ksmbd: Use common error handling code in ksmbd_vfs_path_lookup()
Date: Sat, 04 Oct 2025 21:16:17 +1000 [thread overview]
Message-ID: <175957657719.1793333.15585390544259019306@noble.neil.brown.name> (raw)
In-Reply-To: <2d533e64-8543-402d-9295-5fd2f314f35d@web.de>
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
next prev parent reply other threads:[~2025-10-04 11:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 18:45 [PATCH] ksmbd: Use common error handling code in ksmbd_vfs_path_lookup() Markus Elfring
2025-10-03 22:30 ` NeilBrown
2025-10-04 8:45 ` Markus Elfring
2025-10-04 11:16 ` NeilBrown [this message]
2025-10-04 12:36 ` Markus Elfring
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=175957657719.1793333.15585390544259019306@noble.neil.brown.name \
--to=neilb@ownmail.net \
--cc=Markus.Elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=metze@samba.org \
--cc=neil@brown.name \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--cc=tom@talpey.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).