|
@@ -131,6 +131,8 @@ static int ramfs_nommu_check_mappings(struct inode *inode,
|
|
|
struct vm_area_struct *vma;
|
|
|
struct prio_tree_iter iter;
|
|
|
|
|
|
+ down_write(&nommu_region_sem);
|
|
|
+
|
|
|
/* search for VMAs that fall within the dead zone */
|
|
|
vma_prio_tree_foreach(vma, &iter, &inode->i_mapping->i_mmap,
|
|
|
newsize >> PAGE_SHIFT,
|
|
@@ -138,10 +140,13 @@ static int ramfs_nommu_check_mappings(struct inode *inode,
|
|
|
) {
|
|
|
/* found one - only interested if it's shared out of the page
|
|
|
* cache */
|
|
|
- if (vma->vm_flags & VM_SHARED)
|
|
|
+ if (vma->vm_flags & VM_SHARED) {
|
|
|
+ up_write(&nommu_region_sem);
|
|
|
return -ETXTBSY; /* not quite true, but near enough */
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ up_write(&nommu_region_sem);
|
|
|
return 0;
|
|
|
}
|
|
|
|