Skip to content

Commit dd90196

Browse files
Kent Overstreetbrauner
authored andcommitted
ovl: convert to super_set_uuid()
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. Acked-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Link: https://lore.kernel.org/r/20240207025624.1019754-3-kent.overstreet@linux.dev Cc: Miklos Szeredi <miklos@szeredi.hu> Cc: linux-unionfs@vger.kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent a4af51c commit dd90196

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

fs/overlayfs/util.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -760,13 +760,14 @@ bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs,
760760
const struct path *upperpath)
761761
{
762762
bool set = false;
763+
uuid_t uuid;
763764
int res;
764765

765766
/* Try to load existing persistent uuid */
766-
res = ovl_path_getxattr(ofs, upperpath, OVL_XATTR_UUID, sb->s_uuid.b,
767+
res = ovl_path_getxattr(ofs, upperpath, OVL_XATTR_UUID, uuid.b,
767768
UUID_SIZE);
768769
if (res == UUID_SIZE)
769-
return true;
770+
goto set_uuid;
770771

771772
if (res != -ENODATA)
772773
goto fail;
@@ -794,17 +795,20 @@ bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs,
794795
}
795796

796797
/* Generate overlay instance uuid */
797-
uuid_gen(&sb->s_uuid);
798+
uuid_gen(&uuid);
798799

799800
/* Try to store persistent uuid */
800801
set = true;
801-
res = ovl_setxattr(ofs, upperpath->dentry, OVL_XATTR_UUID, sb->s_uuid.b,
802+
res = ovl_setxattr(ofs, upperpath->dentry, OVL_XATTR_UUID, uuid.b,
802803
UUID_SIZE);
803-
if (res == 0)
804-
return true;
804+
if (res)
805+
goto fail;
806+
807+
set_uuid:
808+
super_set_uuid(sb, uuid.b, sizeof(uuid));
809+
return true;
805810

806811
fail:
807-
memset(sb->s_uuid.b, 0, UUID_SIZE);
808812
ofs->config.uuid = OVL_UUID_NULL;
809813
pr_warn("failed to %s uuid (%pd2, err=%i); falling back to uuid=null.\n",
810814
set ? "set" : "get", upperpath->dentry, res);

0 commit comments

Comments
 (0)