aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/file.c')
-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 4e256b8f56b2..6d34dc7e33e1 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1444,8 +1444,9 @@ static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)
1444 * mmap()d file has taken write protection fault and is being made 1444 * mmap()d file has taken write protection fault and is being made
1445 * writable. UBIFS must ensure page is budgeted for. 1445 * writable. UBIFS must ensure page is budgeted for.
1446 */ 1446 */
1447static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page) 1447static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
1448{ 1448{
1449 struct page *page = vmf->page;
1449 struct inode *inode = vma->vm_file->f_path.dentry->d_inode; 1450 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
1450 struct ubifs_info *c = inode->i_sb->s_fs_info; 1451 struct ubifs_info *c = inode->i_sb->s_fs_info;
1451 struct timespec now = ubifs_current_time(inode); 1452 struct timespec now = ubifs_current_time(inode);
@@ -1457,7 +1458,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
1457 ubifs_assert(!(inode->i_sb->s_flags & MS_RDONLY)); 1458 ubifs_assert(!(inode->i_sb->s_flags & MS_RDONLY));
1458 1459
1459 if (unlikely(c->ro_media)) 1460 if (unlikely(c->ro_media))
1460 return -EROFS; 1461 return VM_FAULT_SIGBUS; /* -EROFS */
1461 1462
1462 /* 1463 /*
1463 * We have not locked @page so far so we may budget for changing the 1464 * We have not locked @page so far so we may budget for changing the
@@ -1490,7 +1491,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
1490 if (err == -ENOSPC) 1491 if (err == -ENOSPC)
1491 ubifs_warn("out of space for mmapped file " 1492 ubifs_warn("out of space for mmapped file "
1492 "(inode number %lu)", inode->i_ino); 1493 "(inode number %lu)", inode->i_ino);
1493 return err; 1494 return VM_FAULT_SIGBUS;
1494 } 1495 }
1495 1496
1496 lock_page(page); 1497 lock_page(page);
@@ -1530,6 +1531,8 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
1530out_unlock: 1531out_unlock:
1531 unlock_page(page); 1532 unlock_page(page);
1532 ubifs_release_budget(c, &req); 1533 ubifs_release_budget(c, &req);
1534 if (err)
1535 err = VM_FAULT_SIGBUS;
1533 return err; 1536 return err;
1534} 1537}
1535 1538