From: Dave Chinner <david@fromorbit.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: brauner@kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, Miklos Szeredi <miklos@szeredi.hu>,
Amir Goldstein <amir73il@gmail.com>,
linux-unionfs@vger.kernel.org
Subject: Re: [PATCH v2 2/7] overlayfs: Convert to super_set_uuid()
Date: Wed, 7 Feb 2024 08:48:57 +1100 [thread overview]
Message-ID: <ZcKpSU9frvTUb2eq@dread.disaster.area> (raw)
In-Reply-To: <20240206201858.952303-3-kent.overstreet@linux.dev>
On Tue, Feb 06, 2024 at 03:18:50PM -0500, Kent Overstreet wrote:
> We don't want to be settingc sb->s_uuid directly anymore, as there's a
> length field that also has to be set, and this conversion was not
> completely trivial.
>
> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
> Cc: Miklos Szeredi <miklos@szeredi.hu>
> Cc: Amir Goldstein <amir73il@gmail.com>
> Cc: linux-unionfs@vger.kernel.org
> ---
> fs/overlayfs/util.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
> index 0217094c23ea..f1f0ee9a9dff 100644
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c
> @@ -760,13 +760,14 @@ bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs,
> const struct path *upperpath)
> {
> bool set = false;
> + uuid_t uuid;
> int res;
>
> /* Try to load existing persistent uuid */
> - res = ovl_path_getxattr(ofs, upperpath, OVL_XATTR_UUID, sb->s_uuid.b,
> + res = ovl_path_getxattr(ofs, upperpath, OVL_XATTR_UUID, uuid.b,
> UUID_SIZE);
> if (res == UUID_SIZE)
> - return true;
> + goto success;
>
> if (res != -ENODATA)
> goto fail;
> @@ -794,14 +795,14 @@ bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs,
> }
>
> /* Generate overlay instance uuid */
> - uuid_gen(&sb->s_uuid);
> + uuid_gen(&uuid);
>
> /* Try to store persistent uuid */
> set = true;
> - res = ovl_setxattr(ofs, upperpath->dentry, OVL_XATTR_UUID, sb->s_uuid.b,
> + res = ovl_setxattr(ofs, upperpath->dentry, OVL_XATTR_UUID, uuid.b,
> UUID_SIZE);
> if (res == 0)
> - return true;
> + goto success;
This is a bit weird. Normally the success case is in line, and we
jump out of line for the fail case. I think this is more better:
if (res)
goto fail;
success:
super_set_uuid(sb, uuid.b, sizeof(uuid));
return true;
>
> fail:
> memset(sb->s_uuid.b, 0, UUID_SIZE);
And then the fail case follows naturally.
-Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2024-02-06 21:49 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 20:18 [PATCH v2 0/7] filesystem visibililty ioctls Kent Overstreet
2024-02-06 20:18 ` [PATCH v2 1/7] fs: super_set_uuid() Kent Overstreet
2024-02-06 21:45 ` Dave Chinner
2024-02-06 20:18 ` [PATCH v2 2/7] overlayfs: Convert to super_set_uuid() Kent Overstreet
2024-02-06 21:48 ` Dave Chinner [this message]
2024-02-07 6:19 ` Amir Goldstein
2024-02-06 20:18 ` [PATCH v2 3/7] fs: FS_IOC_GETUUID Kent Overstreet
2024-02-06 20:29 ` Randy Dunlap
2024-02-06 22:01 ` Dave Chinner
2024-02-06 22:37 ` Kent Overstreet
2024-02-07 0:20 ` Dave Chinner
2024-02-07 13:05 ` Brian Foster
2024-02-08 21:57 ` Kent Overstreet
2024-02-12 12:47 ` Brian Foster
2024-02-12 13:39 ` Kent Overstreet
2024-02-12 16:53 ` Brian Foster
2024-02-06 20:18 ` [PATCH v2 4/7] fat: Hook up sb->s_uuid Kent Overstreet
2024-02-06 20:18 ` [PATCH v2 5/7] fs: FS_IOC_GETSYSFSNAME Kent Overstreet
2024-02-06 22:26 ` Dave Chinner
2024-02-07 0:52 ` Kent Overstreet
2024-02-06 20:18 ` [PATCH v2 6/7] xfs: add support for FS_IOC_GETSYSFSNAME Kent Overstreet
2024-02-06 20:18 ` [PATCH v2 7/7] bcachefs: " Kent Overstreet
2024-02-07 1:47 ` [PATCH v2 0/7] filesystem visibililty ioctls Eric Biggers
2024-02-07 2:09 ` Kent Overstreet
2024-02-07 17:40 ` Theodore Ts'o
2024-02-07 20:26 ` Kent Overstreet
2024-02-08 9:01 ` Christian Brauner
2024-02-12 22:47 ` Theodore Ts'o
2024-02-12 23:24 ` Kent Overstreet
2024-02-08 9:48 ` Christian Brauner
2024-02-08 18:16 ` Kent Overstreet
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=ZcKpSU9frvTUb2eq@dread.disaster.area \
--to=david@fromorbit.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.