Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139159
b: refs/heads/master
c: 56a76f8
h: refs/heads/master
i:
  139157: dd9bbe8
  139155: 97c800e
  139151: 17ee7c4
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Apr 1, 2009
1 parent 6347b9d commit 10d8ac5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c2ec175c39f62949438354f603f4aa170846aabb
refs/heads/master: 56a76f8275c379ed73c8a43cfa1dfa2f5e9cfa19
11 changes: 7 additions & 4 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4307,10 +4307,15 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
u64 page_end;

ret = btrfs_check_data_free_space(root, inode, PAGE_CACHE_SIZE);
if (ret)
if (ret) {
if (ret == -ENOMEM)
ret = VM_FAULT_OOM;
else /* -ENOSPC, -EIO, etc */
ret = VM_FAULT_SIGBUS;
goto out;
}

ret = -EINVAL;
ret = VM_FAULT_NOPAGE; /* make the VM retry the fault */
again:
lock_page(page);
size = i_size_read(inode);
Expand Down Expand Up @@ -4363,8 +4368,6 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
out_unlock:
unlock_page(page);
out:
if (ret)
ret = VM_FAULT_SIGBUS;
return ret;
}

Expand Down
12 changes: 8 additions & 4 deletions trunk/fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,7 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
unsigned long end;
loff_t size;
int ret = -EINVAL;
int ret = VM_FAULT_NOPAGE; /* make the VM retry the fault */

lock_page(page);
size = i_size_read(inode);
Expand All @@ -2340,10 +2340,14 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
if (!ret)
ret = block_commit_write(page, 0, end);

out_unlock:
if (ret)
ret = VM_FAULT_SIGBUS;
if (unlikely(ret)) {
if (ret == -ENOMEM)
ret = VM_FAULT_OOM;
else /* -ENOSPC, -EIO, etc */
ret = VM_FAULT_SIGBUS;
}

out_unlock:
unlock_page(page);
return ret;
}
Expand Down

0 comments on commit 10d8ac5

Please sign in to comment.