[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250113.juseengu1Po2@digikod.net>
Date: Mon, 13 Jan 2025 12:15:05 +0100
From: Mickaël Salaün <mic@...ikod.net>
To: Al Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jeff Layton <jlayton@...nel.org>,
Josef Bacik <josef@...icpanda.com>
Cc: Eric Paris <eparis@...hat.com>, Paul Moore <paul@...l-moore.com>,
Günther Noack <gnoack@...gle.com>, "Serge E . Hallyn" <serge@...lyn.com>,
Ben Scarlato <akhna@...gle.com>, Casey Schaufler <casey@...aufler-ca.com>,
Charles Zaffery <czaffery@...lox.com>, Daniel Burgener <dburgener@...ux.microsoft.com>,
Francis Laniel <flaniel@...ux.microsoft.com>, James Morris <jmorris@...ei.org>, Jann Horn <jannh@...gle.com>,
Jeff Xu <jeffxu@...gle.com>, Jorge Lucangeli Obes <jorgelo@...gle.com>,
Kees Cook <kees@...nel.org>, Konstantin Meskhidze <konstantin.meskhidze@...wei.com>,
Matt Bobrowski <mattbobrowski@...gle.com>, Mikhail Ivanov <ivanov.mikhail1@...wei-partners.com>,
Phil Sutter <phil@....cc>, Praveen K Paladugu <prapal@...ux.microsoft.com>,
Robert Salvet <robert.salvet@...lox.com>, Shervin Oloumi <enlightened@...gle.com>,
Song Liu <song@...nel.org>, Tahera Fahimi <fahimitahera@...il.com>,
Tyler Hicks <code@...icks.com>, audit@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jeff Layton <jlayton@...nel.org>,
Josef Bacik <josef@...icpanda.com>, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v4 27/30] fs: Add iput() cleanup helper
Al, Christian, this standalone patch could be useful to others. Feel
free to pick it in your tree.
On Wed, Jan 08, 2025 at 04:43:35PM +0100, Mickaël Salaün wrote:
> Add a simple scope-based helper to put an inode reference, similar to
> the fput() helper.
>
> This is used in a following commit.
>
> Cc: Al Viro <viro@...iv.linux.org.uk>
> Cc: Christian Brauner <brauner@...nel.org>
> Cc: Jeff Layton <jlayton@...nel.org>
> Cc: Josef Bacik <josef@...icpanda.com>
> Signed-off-by: Mickaël Salaün <mic@...ikod.net>
> Link: https://lore.kernel.org/r/20250108154338.1129069-28-mic@digikod.net
> ---
>
> Changes since v3:
> - New patch.
> ---
> include/linux/fs.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 7e29433c5ecc..bd5a28b0871f 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -47,6 +47,8 @@
> #include <linux/rw_hint.h>
> #include <linux/file_ref.h>
> #include <linux/unicode.h>
> +#include <linux/cleanup.h>
> +#include <linux/err.h>
>
> #include <asm/byteorder.h>
> #include <uapi/linux/fs.h>
> @@ -2698,6 +2700,8 @@ extern void iput(struct inode *);
> int inode_update_timestamps(struct inode *inode, int flags);
> int generic_update_time(struct inode *, int);
>
> +DEFINE_FREE(iput, struct inode *, if (!IS_ERR_OR_NULL(_T)) iput(_T))
> +
> /* /sys/fs */
> extern struct kobject *fs_kobj;
>
> @@ -3108,8 +3112,6 @@ static inline bool is_dot_dotdot(const char *name, size_t len)
> (len == 1 || (len == 2 && name[1] == '.'));
> }
>
> -#include <linux/err.h>
> -
> /* needed for stackable file system support */
> extern loff_t default_llseek(struct file *file, loff_t offset, int whence);
>
> --
> 2.47.1
>
>
Powered by blists - more mailing lists