Summary: | the KERN_LOCKF sysctl returns kl_file_fsid that doesn't match st_dev from stat() | ||
---|---|---|---|
Product: | Base System | Reporter: | Damjan Jovanovic <damjan.jov> |
Component: | kern | Assignee: | Konstantin Belousov <kib> |
Status: | Closed FIXED | ||
Severity: | Affects Some People | CC: | kib, markj |
Priority: | --- | ||
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Damjan Jovanovic
2022-06-17 01:35:54 UTC
Konstantin that's your commit (eca39864f702e577eba3bc7e9992d1e5e56eba58), can you please have a look? Seems reasonable to me, but then the name kl_file_fsid should change to kl_file_dev, IMO. Or the code should use VOP_GETATTR instead (but this is probably slower?) and perform the same translation as other consumers. I intend to commit this patch after tinderbox, as is. Renaming the field is somewhat unfortunate proposal, because this stuff is already in stable. If doing the rename, we probably should still keep some compat #define. I propose to consider this later. (In reply to Konstantin Belousov from comment #3) The sysctl is brand new (not in releng/13.1), so it hasn't had much time to grow consumers and I doubt renaming will break much code. But it's just a suggestion, and indeed can be done later if at all. "fsid" is widely used as the name for dev_t fields in sys/user.h: struct kinfo_file, struct kinfo_ovmentry, struct kinfo_vmentry, and struct kinfo_vmobject use it. I don't think we should rename. We are not changing the meaning of the field, we're changing a meaningless field to meaningful field. Code can only break if it relies on meaningful values, but currently kl_file_fsid is meaningless, almost like an uninitialized variable. And it's only in CURRENT, so it can freely change. A commit in branch main references this bug: 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(-) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c1731fa54dd1eec310729e81e18dd601201405dc commit c1731fa54dd1eec310729e81e18dd601201405dc Author: Damjan Jovanovic <damjan.jov@gmail.com> AuthorDate: 2022-06-17 13:28:16 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-06-24 19:37:33 +0000 KERN_LOCKF: report kl_file_fsid consistently with stat(2) PR: 264723 (cherry picked from commit 8ae769491303715c68e79aaf0e4e2f5c639151f9) sys/kern/kern_lockf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) |