diff options
-rw-r--r-- | mm/filemap_xip.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c index 5b9ec47ea25a..b5167dfb2f2d 100644 --- a/mm/filemap_xip.c +++ b/mm/filemap_xip.c | |||
@@ -248,15 +248,16 @@ again: | |||
248 | int err; | 248 | int err; |
249 | 249 | ||
250 | /* maybe shared writable, allocate new block */ | 250 | /* maybe shared writable, allocate new block */ |
251 | mutex_lock(&xip_sparse_mutex); | ||
251 | error = mapping->a_ops->get_xip_mem(mapping, vmf->pgoff, 1, | 252 | error = mapping->a_ops->get_xip_mem(mapping, vmf->pgoff, 1, |
252 | &xip_mem, &xip_pfn); | 253 | &xip_mem, &xip_pfn); |
254 | mutex_unlock(&xip_sparse_mutex); | ||
253 | if (error) | 255 | if (error) |
254 | return VM_FAULT_SIGBUS; | 256 | return VM_FAULT_SIGBUS; |
255 | /* unmap sparse mappings at pgoff from all other vmas */ | 257 | /* unmap sparse mappings at pgoff from all other vmas */ |
256 | __xip_unmap(mapping, vmf->pgoff); | 258 | __xip_unmap(mapping, vmf->pgoff); |
257 | 259 | ||
258 | found: | 260 | found: |
259 | printk("%s insert %lx@%lx\n", current->comm, (unsigned long)vmf->virtual_address, xip_pfn); | ||
260 | err = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, | 261 | err = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, |
261 | xip_pfn); | 262 | xip_pfn); |
262 | if (err == -ENOMEM) | 263 | if (err == -ENOMEM) |
@@ -340,8 +341,10 @@ __xip_file_write(struct file *filp, const char __user *buf, | |||
340 | &xip_mem, &xip_pfn); | 341 | &xip_mem, &xip_pfn); |
341 | if (status == -ENODATA) { | 342 | if (status == -ENODATA) { |
342 | /* we allocate a new page unmap it */ | 343 | /* we allocate a new page unmap it */ |
344 | mutex_lock(&xip_sparse_mutex); | ||
343 | status = a_ops->get_xip_mem(mapping, index, 1, | 345 | status = a_ops->get_xip_mem(mapping, index, 1, |
344 | &xip_mem, &xip_pfn); | 346 | &xip_mem, &xip_pfn); |
347 | mutex_unlock(&xip_sparse_mutex); | ||
345 | if (!status) | 348 | if (!status) |
346 | /* unmap page at pgoff from all other vmas */ | 349 | /* unmap page at pgoff from all other vmas */ |
347 | __xip_unmap(mapping, index); | 350 | __xip_unmap(mapping, index); |