]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: actually set m_fsname
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:00:49 +0000 (10:00 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:35 +0000 (11:37 -0700)
Set the name of the filesystem before we actually start using it for
creating xfiles.  This leads to nice(r) output from /proc/maps such as:

7fcd0a44f000-7fcd0a450000 rw-s 021f6000 00:01 3612684 /memfd:xfs_repair (/dev/sda): AG 0 rmap records (deleted)

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/init.c

index 6ac9d682490a12ad4a0dfc1f84a6aa6f23583faf..c9c61ac18793b94d81655a9ae1e26fe00c87268b 100644 (file)
@@ -643,6 +643,11 @@ libxfs_mount(
                xfs_set_reporting_corruption(mp);
        libxfs_buftarg_init(mp, xi);
 
+       if (xi->data.name)
+               mp->m_fsname = strdup(xi->data.name);
+       else
+               mp->m_fsname = NULL;
+
        mp->m_finobt_nores = true;
        xfs_set_inode32(mp);
        mp->m_sb = *sb;
@@ -903,6 +908,9 @@ libxfs_umount(
        kmem_free(mp->m_attr_geo);
        kmem_free(mp->m_dir_geo);
 
+       free(mp->m_fsname);
+       mp->m_fsname = NULL;
+
        kmem_free(mp->m_rtdev_targp);
        if (mp->m_logdev_targp != mp->m_ddev_targp)
                kmem_free(mp->m_logdev_targp);