aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/file.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 93b6de51f261..0ff89fe71e51 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1434,8 +1434,9 @@ static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)
1434 * mmap()d file has taken write protection fault and is being made 1434 * mmap()d file has taken write protection fault and is being made
1435 * writable. UBIFS must ensure page is budgeted for. 1435 * writable. UBIFS must ensure page is budgeted for.
1436 */ 1436 */
1437static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page) 1437static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
1438{ 1438{
1439 struct page *page = vmf->page;
1439 struct inode *inode = vma->vm_file->f_path.dentry->d_inode; 1440 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
1440 struct ubifs_info *c = inode->i_sb->s_fs_info; 1441 struct ubifs_info *c = inode->i_sb->s_fs_info;
1441 struct timespec now = ubifs_current_time(inode); 1442 struct timespec now = ubifs_current_time(inode);
@@ -1447,7 +1448,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
1447 ubifs_assert(!(inode->i_sb->s_flags & MS_RDONLY)); 1448 ubifs_assert(!(inode->i_sb->s_flags & MS_RDONLY));
1448 1449
1449 if (unlikely(c->ro_media)) 1450 if (unlikely(c->ro_media))
1450 return -EROFS; 1451 return VM_FAULT_SIGBUS; /* -EROFS */
1451 1452
1452 /* 1453 /*
1453 * We have not locked @page so far so we may budget for changing the 1454 * We have not locked @page so far so we may budget for changing the
@@ -1480,7 +1481,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
1480 if (err == -ENOSPC) 1481 if (err == -ENOSPC)
1481 ubifs_warn("out of space for mmapped file " 1482 ubifs_warn("out of space for mmapped file "
1482 "(inode number %lu)", inode->i_ino); 1483 "(inode number %lu)", inode->i_ino);
1483 return err; 1484 return VM_FAULT_SIGBUS;
1484 } 1485 }
1485 1486
1486 lock_page(page); 1487 lock_page(page);
@@ -1520,6 +1521,8 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
1520out_unlock: 1521out_unlock:
1521 unlock_page(page); 1522 unlock_page(page);
1522 ubifs_release_budget(c, &req); 1523 ubifs_release_budget(c, &req);
1524 if (err)
1525 err = VM_FAULT_SIGBUS;
1523 return err; 1526 return err;
1524} 1527}
1525 1528