On Tue, Mar 14, 2023 at 6:27 AM Catherine Hoang <catherine.hoang@xxxxxxxxxx> wrote: > > Add a new ioctl to set the uuid of a mounted filesystem. > > Signed-off-by: Catherine Hoang <catherine.hoang@xxxxxxxxxx> > --- > fs/xfs/libxfs/xfs_fs.h | 1 + > fs/xfs/xfs_ioctl.c | 107 +++++++++++++++++++++++++++++++++++++++++ > fs/xfs/xfs_log.c | 19 ++++++++ > fs/xfs/xfs_log.h | 2 + > 4 files changed, 129 insertions(+) > > diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h > index 1cfd5bc6520a..a350966cce99 100644 > --- a/fs/xfs/libxfs/xfs_fs.h > +++ b/fs/xfs/libxfs/xfs_fs.h > @@ -831,6 +831,7 @@ struct xfs_scrub_metadata { > #define XFS_IOC_FSGEOMETRY _IOR ('X', 126, struct xfs_fsop_geom) > #define XFS_IOC_BULKSTAT _IOR ('X', 127, struct xfs_bulkstat_req) > #define XFS_IOC_INUMBERS _IOR ('X', 128, struct xfs_inumbers_req) > +#define XFS_IOC_SETFSUUID _IOR ('X', 129, uuid_t) Should be _IOW. Would you consider defining that as FS_IOC_SETFSUUID in fs.h, so that other fs could implement it later on, instead of hoisting it later? It would be easy to add support for FS_IOC_SETFSUUID to ext4 by generalizing ext4_ioctl_setuuid(). Alternatively, we could hoist EXT4_IOC_SETFSUUID and struct fsuuid to fs.h and use that ioctl also for xfs. Using an extensible struct with flags for that ioctl may turn out to be useful, for example, to verify that the new uuid is unique, despite the fact that xfs was mounted with -onouuid (useful IMO) or to explicitly request a restore of old uuid that would fail if new_uuid != meta uuid. Thanks, Amir.