FreeBSD Bugzilla – Attachment 154829 Details for
Bug 198431
Vnode info not provided for memory mapped tmpfs files in various places
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch v2
tmpfs_vnode2.diff (text/plain), 4.21 KB, created by
Eric Badger
on 2015-03-26 15:02:16 UTC
(
hide
)
Description:
Proposed patch v2
Filename:
MIME Type:
Creator:
Eric Badger
Created:
2015-03-26 15:02:16 UTC
Size:
4.21 KB
patch
obsolete
>diff --git sys/compat/linprocfs/linprocfs.c sys/compat/linprocfs/linprocfs.c >index 8607646..0660c70 100644 >--- sys/compat/linprocfs/linprocfs.c >+++ sys/compat/linprocfs/linprocfs.c >@@ -1050,13 +1050,14 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) > ino = 0; > if (lobj) { > off = IDX_TO_OFF(lobj->size); >- if (lobj->type == OBJT_VNODE) { >+ if (lobj->type == OBJT_VNODE) > vp = lobj->handle; >- if (vp) >- vref(vp); >- } >+ else if (lobj->type == OBJT_SWAP && (lobj->flags & OBJ_TMPFS) != 0) >+ vp = lobj->un_pager.swp.swp_tmpfs; > else > vp = NULL; >+ if (vp) >+ vref(vp); > if (lobj != obj) > VM_OBJECT_RUNLOCK(lobj); > flags = obj->flags; >diff --git sys/dev/hwpmc/hwpmc_mod.c sys/dev/hwpmc/hwpmc_mod.c >index cb8ed37..5ea3454 100644 >--- sys/dev/hwpmc/hwpmc_mod.c >+++ sys/dev/hwpmc/hwpmc_mod.c >@@ -1655,19 +1655,25 @@ pmc_log_process_mappings(struct pmc_owner *po, struct proc *p) > continue; > } > >- if (lobj->type != OBJT_VNODE || lobj->handle == NULL) { >+ if ((lobj->type != OBJT_VNODE || lobj->handle == NULL) && >+ (lobj->type != OBJT_SWAP || (lobj->flags & OBJ_TMPFS) == 0)) { > if (lobj != obj) > VM_OBJECT_RUNLOCK(lobj); > VM_OBJECT_RUNLOCK(obj); > continue; > } > >+ if (lobj->type == OBJT_VNODE) >+ vp = lobj->handle; >+ else if (lobj->type == OBJT_SWAP && (lobj->flags & OBJ_TMPFS) != 0) >+ vp = lobj->un_pager.swp.swp_tmpfs; >+ > /* > * Skip contiguous regions that point to the same > * vnode, so we don't emit redundant MAP-IN > * directives. > */ >- if (entry->start == last_end && lobj->handle == last_vp) { >+ if (entry->start == last_end && vp == last_vp) { > last_end = entry->end; > if (lobj != obj) > VM_OBJECT_RUNLOCK(lobj); >@@ -1690,7 +1696,6 @@ pmc_log_process_mappings(struct pmc_owner *po, struct proc *p) > last_timestamp = map->timestamp; > vm_map_unlock_read(map); > >- vp = lobj->handle; > vref(vp); > if (lobj != obj) > VM_OBJECT_RUNLOCK(lobj); >diff --git sys/fs/procfs/procfs_map.c sys/fs/procfs/procfs_map.c >index eae70229..149fb64 100644 >--- sys/fs/procfs/procfs_map.c >+++ sys/fs/procfs/procfs_map.c >@@ -171,8 +171,16 @@ procfs_doprocmap(PFS_FILL_ARGS) > vref(vp); > break; > case OBJT_SWAP: >- type = "swap"; >- vp = NULL; >+ if ((lobj->flags & OBJ_TMPFS_NODE) != 0) { >+ type = "vnode"; >+ if ((lobj->flags & OBJ_TMPFS) != 0) { >+ vp = lobj->un_pager.swp.swp_tmpfs; >+ vref(vp); >+ } >+ } else { >+ type = "swap"; >+ vp = NULL; >+ } > break; > case OBJT_SG: > case OBJT_DEVICE: >diff --git sys/kern/kern_proc.c sys/kern/kern_proc.c >index 2aa5c4a..df3602d 100644 >--- sys/kern/kern_proc.c >+++ sys/kern/kern_proc.c >@@ -2110,7 +2110,15 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) > vref(vp); > break; > case OBJT_SWAP: >- kve->kve_type = KVME_TYPE_SWAP; >+ if ((lobj->flags & OBJ_TMPFS_NODE) != 0) { >+ kve->kve_type = KVME_TYPE_VNODE; >+ if ((lobj->flags & OBJ_TMPFS) != 0) { >+ vp = lobj->un_pager.swp.swp_tmpfs; >+ vref(vp); >+ } >+ } else { >+ kve->kve_type = KVME_TYPE_SWAP; >+ } > break; > case OBJT_DEVICE: > kve->kve_type = KVME_TYPE_DEVICE; >@@ -2336,7 +2344,15 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb) > vref(vp); > break; > case OBJT_SWAP: >- kve->kve_type = KVME_TYPE_SWAP; >+ if ((lobj->flags & OBJ_TMPFS_NODE) != 0) { >+ kve->kve_type = KVME_TYPE_VNODE; >+ if ((lobj->flags & OBJ_TMPFS) != 0) { >+ vp = lobj->un_pager.swp.swp_tmpfs; >+ vref(vp); >+ } >+ } else { >+ kve->kve_type = KVME_TYPE_SWAP; >+ } > break; > case OBJT_DEVICE: > kve->kve_type = KVME_TYPE_DEVICE; >diff --git sys/kern/sys_process.c sys/kern/sys_process.c >index 7dd3d17..a62d9c1 100644 >--- sys/kern/sys_process.c >+++ sys/kern/sys_process.c >@@ -402,9 +402,16 @@ ptrace_vm_entry(struct thread *td, struct proc *p, struct ptrace_vm_entry *pve) > lobj = tobj; > pve->pve_offset += tobj->backing_object_offset; > } >- vp = (lobj->type == OBJT_VNODE) ? lobj->handle : NULL; >+ >+ if (lobj->type == OBJT_VNODE) >+ vp = lobj->handle; >+ else if (lobj->type == OBJT_SWAP && (lobj->flags & OBJ_TMPFS) != 0) >+ vp = lobj->un_pager.swp.swp_tmpfs; >+ else >+ vp = NULL; > if (vp != NULL) > vref(vp); >+ > if (lobj != obj) > VM_OBJECT_RUNLOCK(lobj); > VM_OBJECT_RUNLOCK(obj);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 198431
:
154029
| 154829