xfs: Print XFS UUID on mount and umount events.
RFC PATCH v2 1/1 xfs: Print XFS UUID on mount and umount events.
As of now only device names are printed out over __xfs_printk(). The device names are not persistent across reboots which in case of searching for origin of corruption brings another task to properly identify the devices. This patch add XFS UUID upon every mount/umount event which will make the identification much easier.
---
V2: Drop void casts and fix long lines
fs/xfs/xfs_log.c | 10 ++++++---- fs/xfs/xfs_super.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)
fs/xfs/xfs_log.c +6 -4
@@ -570,12 +570,14 @@ xfs_log_mount(int min_logfsbs;if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -xfs_notice (mp,"Mounting V%d Filesystem" , -XFS_SB_VERSION_NUM (&mp->m_sb)); +xfs_notice (mp,"Mounting V%d Filesystem %pU" , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid); }else {xfs_notice (mp, -"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent." , -XFS_SB_VERSION_NUM (&mp->m_sb)); +"Mounting V%d filesystem %pU in no-recovery mode. Filesystem will be inconsistent." , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid);ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); }
fs/xfs/xfs_super.c +1 -1
@@ -1043,7 +1043,7 @@ xfs_fs_put_super(if (!sb->s_fs_info)return ; -xfs_notice (mp,"Unmounting Filesystem" ); +xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp);
Signature · 1 line
2.31.1
Quoted 5 lines · Lukas Herbolt
As of now only device names are printed out over
__xfs_printk(). The device names are not persistent across reboots which in case of searching for origin of corruption brings another task to properly identify the devices. This patch add XFS UUID upon every mount/umount event which will make the identification much easier.
A few questions....
Are you going to wire up fs uuid logging for the other filesystems that support them?
What happens w.r.t. uuid disambiguation if someone uses a nouuid mount to mount a filesystem with the same uuid as an already-mounted xfs?
The changes themselves look ok, but I'm wondering what the use case is here.
--D
Quoted 48 lines
Signed-off-by Lukas Herbolt <[email protected]>---
V2: Drop void casts and fix long linesfs/xfs/xfs_log.c | 10 ++++++---- fs/xfs/xfs_super.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)fs/xfs/xfs_log.c +6
-4@@ -570,12 +570,14 @@ xfs_log_mount(int min_logfsbs;if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -xfs_notice (mp,"Mounting V%d Filesystem" , -XFS_SB_VERSION_NUM (&mp->m_sb)); +xfs_notice (mp,"Mounting V%d Filesystem %pU" , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid); }else {xfs_notice (mp, -"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent." , -XFS_SB_VERSION_NUM (&mp->m_sb)); +"Mounting V%d filesystem %pU in no-recovery mode. Filesystem will be inconsistent." , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid);ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); }fs/xfs/xfs_super.c +1
-1@@ -1043,7 +1043,7 @@ xfs_fs_put_super(if (!sb->s_fs_info)return ; -xfs_notice (mp,"Unmounting Filesystem" ); +xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp);Signature · 1 line
2.31.1
Quoted 2 lines
Are you going to wire up fs uuid logging for the other filesystems that support them?
Well, I wasn't planning to but I can take a look on other FS as well Ext4 and Btrfs for start.
Quoted 2 lines
What happens w.r.t. uuid disambiguation if someone uses a nouuid mount to mount a filesystem with the same uuid as an already-mounted xfs?
I a not sure I understand the "nouuid mount". I don't think there can be XFS with empty uuid value in SB. And printing the message is independent on the mount method (mount UUID="" ...; mount /dev/sdX ...;).
Quoted 70 lines · Darrick J. Wong
Quoted 5 lines · Lukas Herbolt
As of now only device names are printed out over
__xfs_printk(). The device names are not persistent across reboots which in case of searching for origin of corruption brings another task to properly identify the devices. This patch add XFS UUID upon every mount/umount event which will make the identification much easier.A few questions....
Are you going to wire up fs uuid logging for the other filesystems that support them?
What happens w.r.t. uuid disambiguation if someone uses a nouuid mount to mount a filesystem with the same uuid as an already-mounted xfs?
The changes themselves look ok, but I'm wondering what the use case is here.
--D
Quoted 50 lines
Signed-off-by Lukas Herbolt <[email protected]>---
V2: Drop void casts and fix long linesfs/xfs/xfs_log.c | 10 ++++++---- fs/xfs/xfs_super.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)fs/xfs/xfs_log.c +6
-4@@ -570,12 +570,14 @@ xfs_log_mount(int min_logfsbs;if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -xfs_notice (mp,"Mounting V%d Filesystem" , -XFS_SB_VERSION_NUM (&mp->m_sb)); +xfs_notice (mp,"Mounting V%d Filesystem %pU" , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid); }else {xfs_notice (mp, -"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent.", -XFS_SB_VERSION_NUM (&mp->m_sb)); +"Mounting V%d filesystem %pU in no-recovery mode. Filesystem will be inconsistent.", +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid);ASSERT (mp->m_flags &XFS_MOUNT_RDONLY );fs/xfs/xfs_log.c +0
-0}fs/xfs/xfs_super.c +1
-2@@ -1043,7 +1043,7 @@ xfs_fs_put_super(if (!sb->s_fs_info)return ; -xfs_notice (mp,"Unmounting Filesystem" ); +xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp); --2.31.1
Quoted 11 lines · On Fri, May 21, 2021 at 11:03:11AM +0200, [email protected] wrote:
Quoted 2 lines
Are you going to wire up fs uuid logging for the other filesystems that support them?
Well, I wasn't planning to but I can take a look on other FS as well Ext4 and Btrfs for start.
Quoted 2 lines
What happens w.r.t. uuid disambiguation if someone uses a nouuid mount to mount a filesystem with the same uuid as an already-mounted xfs?
I a not sure I understand the "nouuid mount". I don't think there can be XFS with empty uuid value in SB. And printing the message is independent on the mount method (mount UUID="" ...; mount
/dev/sdX...;).
I meant specifically:
mount /dev/mapper/fubar /mnt
<snapshot fubar to fubar.bak>
Oh no, I deleted something in fubar, let's retrieve it from fubar.bak!
mount /dev/mapper/fubar.bak /opt # fails because same uuid as fubar
mount /dev/mapper/fubar.bak /opt -o nouuid
--D
Quoted 73 lines · Darrick J. Wong
Quoted 70 lines · Lukas Herbolt
Quoted 5 lines
As of now only device names are printed out over
__xfs_printk(). The device names are not persistent across reboots which in case of searching for origin of corruption brings another task to properly identify the devices. This patch add XFS UUID upon every mount/umount event which will make the identification much easier.A few questions....
Are you going to wire up fs uuid logging for the other filesystems that support them?
What happens w.r.t. uuid disambiguation if someone uses a nouuid mount to mount a filesystem with the same uuid as an already-mounted xfs?
The changes themselves look ok, but I'm wondering what the use case is here.
--D
Quoted 50 lines
Signed-off-by Lukas Herbolt <[email protected]>---
V2: Drop void casts and fix long linesfs/xfs/xfs_log.c | 10 ++++++---- fs/xfs/xfs_super.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)fs/xfs/xfs_log.c +6
-4@@ -570,12 +570,14 @@ xfs_log_mount(int min_logfsbs;if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -xfs_notice (mp,"Mounting V%d Filesystem" , -XFS_SB_VERSION_NUM (&mp->m_sb)); +xfs_notice (mp,"Mounting V%d Filesystem %pU" , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid); }else {xfs_notice (mp, -"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent.", -XFS_SB_VERSION_NUM (&mp->m_sb)); +"Mounting V%d filesystem %pU in no-recovery mode. Filesystem will be inconsistent.", +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid);ASSERT (mp->m_flags &XFS_MOUNT_RDONLY );fs/xfs/xfs_log.c +0
-0}fs/xfs/xfs_super.c +1
-2@@ -1043,7 +1043,7 @@ xfs_fs_put_super(if (!sb->s_fs_info)return ; -xfs_notice (mp,"Unmounting Filesystem" ); +xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp); --2.31.1
Quoted 15 lines · Darrick J. Wong
Quoted 11 lines · On Fri, May 21, 2021 at 11:03:11AM +0200, [email protected] wrote:
Quoted 2 lines
Are you going to wire up fs uuid logging for the other filesystems that support them?
Well, I wasn't planning to but I can take a look on other FS as well Ext4 and Btrfs for start.
Quoted 2 lines
What happens w.r.t. uuid disambiguation if someone uses a nouuid mount to mount a filesystem with the same uuid as an already-mounted xfs?
I a not sure I understand the "nouuid mount". I don't think there can be XFS with empty uuid value in SB. And printing the message is independent on the mount method (mount UUID="" ...; mount
/dev/sdX...;).I meant specifically:
Quoted 7 lines
mount
/dev/mapper/fubar/mnt
<snapshot fubar to fubar.bak>Oh no, I deleted something in fubar, let's retrieve it from fubar.bak!
mount
/dev/mapper/fubar.bak/opt # fails because same uuid as fubar
mount/dev/mapper/fubar.bak/opt -o nouuid
While it is possible to end up with 2 mounted devices with the same UUID, that's still useful information I think; to me, the -o nouuid case doesn't really argue against this patch.
In fact, it could be /very/ useful information if someone force-mounted 2 paths to the same underlying device by using -o nouuid.
-Eric
Quoted 18 lines · Darrick J. Wong
Quoted 11 lines · On Fri, May 21, 2021 at 11:03:11AM +0200, [email protected] wrote:
Quoted 2 lines
Are you going to wire up fs uuid logging for the other filesystems that support them?
Well, I wasn't planning to but I can take a look on other FS as well Ext4 and Btrfs for start.
Quoted 2 lines
What happens w.r.t. uuid disambiguation if someone uses a nouuid mount to mount a filesystem with the same uuid as an already-mounted xfs?
I a not sure I understand the "nouuid mount". I don't think there can be XFS with empty uuid value in SB. And printing the message is independent on the mount method (mount UUID="" ...; mount
/dev/sdX...;).I meant specifically:
mount
/dev/mapper/fubar/mnt
<snapshot fubar to fubar.bak>
Quoted 7 lines
Oh no, I deleted something in fubar, let's retrieve it from fubar.bak!
mount
/dev/mapper/fubar.bak/opt # fails because same uuid as fubar
mount/dev/mapper/fubar.bak/opt -o nouuid--D
Ah, right. Well using -o nouuid might have it's own info/notice in the logs to make it clear.
Quoted 73 lines
Quoted 73 lines · Darrick J. Wong
Quoted 70 lines · Lukas Herbolt
Quoted 5 lines
As of now only device names are printed out over
__xfs_printk(). The device names are not persistent across reboots which in case of searching for origin of corruption brings another task to properly identify the devices. This patch add XFS UUID upon every mount/umount event which will make the identification much easier.A few questions....
Are you going to wire up fs uuid logging for the other filesystems that support them?
What happens w.r.t. uuid disambiguation if someone uses a nouuid mount to mount a filesystem with the same uuid as an already-mounted xfs?
The changes themselves look ok, but I'm wondering what the use case is here.
--D
Quoted 50 lines
Signed-off-by Lukas Herbolt <[email protected]>---
V2: Drop void casts and fix long linesfs/xfs/xfs_log.c | 10 ++++++---- fs/xfs/xfs_super.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)fs/xfs/xfs_log.c +6
-4@@ -570,12 +570,14 @@ xfs_log_mount(int min_logfsbs;if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -xfs_notice (mp,"Mounting V%d Filesystem" , -XFS_SB_VERSION_NUM (&mp->m_sb)); +xfs_notice (mp,"Mounting V%d Filesystem %pU" , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid); }else {xfs_notice (mp, -"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent.", -XFS_SB_VERSION_NUM (&mp->m_sb)); +"Mounting V%d filesystem %pU in no-recovery mode. Filesystem will be inconsistent.", +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid);ASSERT (mp->m_flags &XFS_MOUNT_RDONLY );fs/xfs/xfs_log.c +0
-0}fs/xfs/xfs_super.c +1
-2@@ -1043,7 +1043,7 @@ xfs_fs_put_super(if (!sb->s_fs_info)return ; -xfs_notice (mp,"Unmounting Filesystem" ); +xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp); --2.31.1
Quoted 9 lines · Lukas Herbolt
As of now only device names are printed out over
__xfs_printk(). The device names are not persistent across reboots which in case of searching for origin of corruption brings another task to properly identify the devices. This patch add XFS UUID upon every mount/umount event which will make the identification much easier.Signed-off-by Lukas Herbolt <[email protected]>---
V2: Drop void casts and fix long lines
Can we revisit this? I think it's a nice enhancement.
The "nouuid" concern raised in the thread doesn't seem like a problem; if someone mounts with "-o nouuid" then you'll see 2 different devices mounted with the same uuid printed. I don't think that's an argument against the patch. Printing the uuid still provides more info than not.
I, uh, also don't think the submitter should be required to do a tree-wide change for an xfs printk enhancement. Sure, it'd be nice to have ext4 and btrfs and and and but we have no other requirements that mount-time messages must be consistent across all filesystems....
Thanks,
-Eric
Quoted 41 lines
fs/xfs/xfs_log.c | 10 ++++++---- fs/xfs/xfs_super.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)fs/xfs/xfs_log.c +6
-4@@ -570,12 +570,14 @@ xfs_log_mount(int min_logfsbs;if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -xfs_notice (mp,"Mounting V%d Filesystem" , -XFS_SB_VERSION_NUM (&mp->m_sb)); +xfs_notice (mp,"Mounting V%d Filesystem %pU" , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid); }else {xfs_notice (mp, -"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent." , -XFS_SB_VERSION_NUM (&mp->m_sb)); +"Mounting V%d filesystem %pU in no-recovery mode. Filesystem will be inconsistent." , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid);ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); }fs/xfs/xfs_super.c +1
-1@@ -1043,7 +1043,7 @@ xfs_fs_put_super(if (!sb->s_fs_info)return ; -xfs_notice (mp,"Unmounting Filesystem" ); +xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp);
Quoted 11 lines · Eric Sandeen
Quoted 9 lines · Lukas Herbolt
As of now only device names are printed out over
__xfs_printk(). The device names are not persistent across reboots which in case of searching for origin of corruption brings another task to properly identify the devices. This patch add XFS UUID upon every mount/umount event which will make the identification much easier.Signed-off-by Lukas Herbolt <[email protected]>---
V2: Drop void casts and fix long lines
Quoted 6 lines
Can we revisit this? I think it's a nice enhancement.
The "nouuid" concern raised in the thread doesn't seem like a problem; if someone mounts with "-o nouuid" then you'll see 2 different devices mounted with the same uuid printed. I don't think that's an argument against the patch. Printing the uuid still provides more info than not.
Ok fair.
Quoted 4 lines
I, uh, also don't think the submitter should be required to do a tree-wide change for an xfs printk enhancement. Sure, it'd be nice to have ext4 and btrfs and and and but we have no other requirements that mount-time messages must be consistent across all filesystems....
As you pointed out on irc, btrfs already prints its own uuids. So that leaves ext4 -- are you all planning to send a patch for that?
(Otherwise, I don't mind this patch, if it helps support perform forensics on systems with a lot of filesystem activity.)
Quoted 15 lines
Thanks,
-EricQuoted 12 lines
fs/xfs/xfs_log.c | 10 ++++++---- fs/xfs/xfs_super.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)fs/xfs/xfs_log.c +0
-0@@ -570,12 +570,14 @@ xfs_log_mount(int min_logfsbs;
Quoted 13 lines
fs/xfs/xfs_log.c xfs_log_mount( · line 580
Quoted 13 lines
fs/xfs/xfs_log.c +6
-4if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -xfs_notice (mp,"Mounting V%d Filesystem" , -XFS_SB_VERSION_NUM (&mp->m_sb)); +xfs_notice (mp,"Mounting V%d Filesystem %pU" , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid); }else {xfs_notice (mp, -"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent." , -XFS_SB_VERSION_NUM (&mp->m_sb)); +"Mounting V%d filesystem %pU in no-recovery mode. Filesystem will be inconsistent." , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid);
sb_uuid is the uuid that the user can set, not the one that's encoded identically in all the cloud vm images, right?
--D
Quoted 16 lines
Quoted 16 lines
fs/xfs/xfs_log.c +0
-0ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); }fs/xfs/xfs_super.c +1
-1@@ -1043,7 +1043,7 @@ xfs_fs_put_super(if (!sb->s_fs_info)return ; -xfs_notice (mp,"Unmounting Filesystem" ); +xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp);
Quoted 21 lines · Darrick J. Wong
Quoted 11 lines · Eric Sandeen
Quoted 9 lines · Lukas Herbolt
As of now only device names are printed out over
__xfs_printk(). The device names are not persistent across reboots which in case of searching for origin of corruption brings another task to properly identify the devices. This patch add XFS UUID upon every mount/umount event which will make the identification much easier.Signed-off-by Lukas Herbolt <[email protected]>---
V2: Drop void casts and fix long linesQuoted 6 lines
Can we revisit this? I think it's a nice enhancement.
The "nouuid" concern raised in the thread doesn't seem like a problem; if someone mounts with "-o nouuid" then you'll see 2 different devices mounted with the same uuid printed. I don't think that's an argument against the patch. Printing the uuid still provides more info than not.
Ok fair.
Quoted 7 lines
Quoted 4 lines
I, uh, also don't think the submitter should be required to do a tree-wide change for an xfs printk enhancement. Sure, it'd be nice to have ext4 and btrfs and and and but we have no other requirements that mount-time messages must be consistent across all filesystems....
As you pointed out on irc, btrfs already prints its own uuids. So that leaves ext4 -- are you all planning to send a patch for that?
I threw one together, need to actually test and send it, but sure.
Quoted 2 lines
(Otherwise, I don't mind this patch, if it helps support perform forensics on systems with a lot of filesystem activity.)
Cool, thanks.
Quoted 15 lines
Quoted 15 lines
Thanks,
-EricQuoted 12 lines
fs/xfs/xfs_log.c | 10 ++++++---- fs/xfs/xfs_super.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)fs/xfs/xfs_log.c +0
-0@@ -570,12 +570,14 @@ xfs_log_mount(int min_logfsbs;
Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
fs/xfs/xfs_log.c +2
-2if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -xfs_notice (mp,"Mounting V%d Filesystem" , -XFS_SB_VERSION_NUM (&mp->m_sb)); + xfs_notice(mp, "Mounting V%d Filesystem %pU", + XFS_SB_VERSION_NUM(&mp->m_sb),Quoted 8 lines
fs/xfs/xfs_log.c xfs_log_mount( · line 580
Quoted 8 lines
fs/xfs/xfs_log.c +4
-2+ &mp->m_sb.sb_uuid); }else {xfs_notice (mp, -"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent." , -XFS_SB_VERSION_NUM (&mp->m_sb)); +"Mounting V%d filesystem %pU in no-recovery mode. Filesystem will be inconsistent." , +XFS_SB_VERSION_NUM (&mp->m_sb), + &mp->m_sb.sb_uuid);
sb_uuidis the uuid that the user can set, not the one that's encoded identically in all the cloud vm images, right?
Uhhh yeah I think so, and "sb_meta_uuid" is the internal one that remains unchanged but I will double check because even though I wrote that, it's un-intuitive. :(
Thanks,
-Eric
Quoted 20 lines
--D
Quoted 16 lines
Quoted 16 lines
fs/xfs/xfs_log.c +0
-0ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); }fs/xfs/xfs_super.c +1
-1@@ -1043,7 +1043,7 @@ xfs_fs_put_super(if (!sb->s_fs_info)return ; -xfs_notice (mp,"Unmounting Filesystem" ); +xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp);