Revert "ANDROID: add vma->file_ref_count to synchronize vma->vm_file destruction"

This reverts commit a3fe25d923.

File refcounting implemented in this patch is broken and needs to be
redone.
The change in include/linux/mm_types.h which adds file_ref_count into
vm_area_struct is left untouched to keep ABI intact.

Bug: 258731892
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I37984eb2f0981a989f74bcaaa6be42040a2f241e
This commit is contained in:
Suren Baghdasaryan
2022-11-11 12:58:46 -08:00
parent 578745e43f
commit a07770525e
2 changed files with 2 additions and 20 deletions

View File

@@ -383,6 +383,8 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig)
static inline void ____vm_area_free(struct vm_area_struct *vma)
{
if (vma->vm_file)
fput(vma->vm_file);
kmem_cache_free(vm_area_cachep, vma);
}
@@ -400,15 +402,10 @@ void vm_area_free(struct vm_area_struct *vma)
free_anon_vma_name(vma);
#ifdef CONFIG_SPECULATIVE_PAGE_FAULT
if (atomic_read(&vma->vm_mm->mm_users) > 1) {
if (vma->vm_file)
vma_put_file_ref(vma);
call_rcu(&vma->vm_rcu, __vm_area_free);
return;
}
#endif
if (vma->vm_file)
fput(vma->vm_file);
____vm_area_free(vma);
}