git: 4d903a1a74d9 - main - tmpfs_getattr(): Only take vm_object lock on 32bit machines
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Dec 2022 17:09:23 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4d903a1a74d9526aba4d177e89c10f97df5662f2 commit 4d903a1a74d9526aba4d177e89c10f97df5662f2 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-12-17 11:03:32 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-12-17 17:01:56 +0000 tmpfs_getattr(): Only take vm_object lock on 32bit machines Torn reads are only possible for 32bit arches. Requested by: mjg Reviewed by: mjg, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37725 --- sys/fs/tmpfs/tmpfs_vnops.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 4d95441c05e4..1e3a4ac68f3f 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -491,7 +491,6 @@ tmpfs_getattr(struct vop_getattr_args *v) { struct vnode *vp = v->a_vp; struct vattr *vap = v->a_vap; - vm_object_t obj; struct tmpfs_node *node; node = VP_TO_TMPFS_NODE(vp); @@ -516,10 +515,15 @@ tmpfs_getattr(struct vop_getattr_args *v) vap->va_rdev = (vp->v_type == VBLK || vp->v_type == VCHR) ? node->tn_rdev : NODEV; if (vp->v_type == VREG) { - obj = node->tn_reg.tn_aobj; +#ifdef __ILP32__ + vm_object_t obj = node->tn_reg.tn_aobj; + VM_OBJECT_RLOCK(obj); +#endif vap->va_bytes = ptoa(node->tn_reg.tn_pages); +#ifdef __ILP32__ VM_OBJECT_RUNLOCK(obj); +#endif } else { vap->va_bytes = node->tn_size; }