diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ramfs/file-nommu.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 2efc57173fd7..266531343aae 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -131,6 +131,8 @@ static int ramfs_nommu_check_mappings(struct inode *inode, | |||
131 | struct vm_area_struct *vma; | 131 | struct vm_area_struct *vma; |
132 | struct prio_tree_iter iter; | 132 | struct prio_tree_iter iter; |
133 | 133 | ||
134 | down_write(&nommu_region_sem); | ||
135 | |||
134 | /* search for VMAs that fall within the dead zone */ | 136 | /* search for VMAs that fall within the dead zone */ |
135 | vma_prio_tree_foreach(vma, &iter, &inode->i_mapping->i_mmap, | 137 | vma_prio_tree_foreach(vma, &iter, &inode->i_mapping->i_mmap, |
136 | newsize >> PAGE_SHIFT, | 138 | newsize >> PAGE_SHIFT, |
@@ -138,10 +140,13 @@ static int ramfs_nommu_check_mappings(struct inode *inode, | |||
138 | ) { | 140 | ) { |
139 | /* found one - only interested if it's shared out of the page | 141 | /* found one - only interested if it's shared out of the page |
140 | * cache */ | 142 | * cache */ |
141 | if (vma->vm_flags & VM_SHARED) | 143 | if (vma->vm_flags & VM_SHARED) { |
144 | up_write(&nommu_region_sem); | ||
142 | return -ETXTBSY; /* not quite true, but near enough */ | 145 | return -ETXTBSY; /* not quite true, but near enough */ |
146 | } | ||
143 | } | 147 | } |
144 | 148 | ||
149 | up_write(&nommu_region_sem); | ||
145 | return 0; | 150 | return 0; |
146 | } | 151 | } |
147 | 152 | ||