git: 8ae769491303 - main - KERN_LOCKF: report kl_file_fsid consistently with stat(2)

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 18 Jun 2022 09:34:53 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=8ae769491303715c68e79aaf0e4e2f5c639151f9

commit 8ae769491303715c68e79aaf0e4e2f5c639151f9
Author:     Damjan Jovanovic <damjan.jov@gmail.com>
AuthorDate: 2022-06-17 13:28:16 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-06-18 09:34:17 +0000

    KERN_LOCKF: report kl_file_fsid consistently with stat(2)
    
    PR:     264723
    Reviewed by:    kib
    Discussed with: markj
    MFC after:      1 week
---
 sys/kern/kern_lockf.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c
index cad208197e76..98e29b2c9292 100644
--- a/sys/kern/kern_lockf.c
+++ b/sys/kern/kern_lockf.c
@@ -2479,7 +2479,6 @@ vfs_report_lockf(struct mount *mp, struct sbuf *sb)
 	struct ucred *ucred;
 	char *fullpath, *freepath;
 	struct stat stt;
-	fsid_t fsidx;
 	STAILQ_HEAD(, kinfo_lockf_linked) locks;
 	int error, gerror;
 
@@ -2522,7 +2521,6 @@ vfs_report_lockf(struct mount *mp, struct sbuf *sb)
 
 	gerror = 0;
 	ucred = curthread->td_ucred;
-	fsidx = mp->mnt_stat.f_fsid;
 	while ((klf = STAILQ_FIRST(&locks)) != NULL) {
 		STAILQ_REMOVE_HEAD(&locks, link);
 		vp = klf->vp;
@@ -2532,8 +2530,7 @@ vfs_report_lockf(struct mount *mp, struct sbuf *sb)
 				error = VOP_STAT(vp, &stt, ucred, NOCRED);
 			VOP_UNLOCK(vp);
 			if (error == 0) {
-				memcpy(&klf->kl.kl_file_fsid, &fsidx,
-				    sizeof(fsidx));
+				klf->kl.kl_file_fsid = stt.st_dev;
 				klf->kl.kl_file_rdev = stt.st_rdev;
 				klf->kl.kl_file_fileid = stt.st_ino;
 				freepath = NULL;