aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2022-12-17 11:03:32 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-12-17 17:01:56 +0000
commit4d903a1a74d9526aba4d177e89c10f97df5662f2 (patch)
tree0e281737fea083d2e2734d8f218ab105ba2c4ac8
parent3249449190c2c71ecfc4fa5f518f94ff552df440 (diff)
downloadsrc-4d903a1a74d9526aba4d177e89c10f97df5662f2.tar.gz
src-4d903a1a74d9526aba4d177e89c10f97df5662f2.zip
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
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c8
1 files 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;
}