diff options
Diffstat (limited to 'fs/ocfs2/mmap.c')
| -rw-r--r-- | fs/ocfs2/mmap.c | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 7898bd3a99f5..af2b8fe1f139 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
| @@ -41,44 +41,20 @@ | |||
| 41 | #include "file.h" | 41 | #include "file.h" |
| 42 | #include "inode.h" | 42 | #include "inode.h" |
| 43 | #include "mmap.h" | 43 | #include "mmap.h" |
| 44 | #include "super.h" | ||
| 44 | 45 | ||
| 45 | static inline int ocfs2_vm_op_block_sigs(sigset_t *blocked, sigset_t *oldset) | ||
| 46 | { | ||
| 47 | /* The best way to deal with signals in the vm path is | ||
| 48 | * to block them upfront, rather than allowing the | ||
| 49 | * locking paths to return -ERESTARTSYS. */ | ||
| 50 | sigfillset(blocked); | ||
| 51 | |||
| 52 | /* We should technically never get a bad return value | ||
| 53 | * from sigprocmask */ | ||
| 54 | return sigprocmask(SIG_BLOCK, blocked, oldset); | ||
| 55 | } | ||
| 56 | |||
| 57 | static inline int ocfs2_vm_op_unblock_sigs(sigset_t *oldset) | ||
| 58 | { | ||
| 59 | return sigprocmask(SIG_SETMASK, oldset, NULL); | ||
| 60 | } | ||
| 61 | 46 | ||
| 62 | static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf) | 47 | static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf) |
| 63 | { | 48 | { |
| 64 | sigset_t blocked, oldset; | 49 | sigset_t oldset; |
| 65 | int error, ret; | 50 | int ret; |
| 66 | 51 | ||
| 67 | mlog_entry("(area=%p, page offset=%lu)\n", area, vmf->pgoff); | 52 | mlog_entry("(area=%p, page offset=%lu)\n", area, vmf->pgoff); |
| 68 | 53 | ||
| 69 | error = ocfs2_vm_op_block_sigs(&blocked, &oldset); | 54 | ocfs2_block_signals(&oldset); |
| 70 | if (error < 0) { | ||
| 71 | mlog_errno(error); | ||
| 72 | ret = VM_FAULT_SIGBUS; | ||
| 73 | goto out; | ||
| 74 | } | ||
| 75 | |||
| 76 | ret = filemap_fault(area, vmf); | 55 | ret = filemap_fault(area, vmf); |
| 56 | ocfs2_unblock_signals(&oldset); | ||
| 77 | 57 | ||
| 78 | error = ocfs2_vm_op_unblock_sigs(&oldset); | ||
| 79 | if (error < 0) | ||
| 80 | mlog_errno(error); | ||
| 81 | out: | ||
| 82 | mlog_exit_ptr(vmf->page); | 58 | mlog_exit_ptr(vmf->page); |
| 83 | return ret; | 59 | return ret; |
| 84 | } | 60 | } |
| @@ -158,14 +134,10 @@ static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 158 | struct page *page = vmf->page; | 134 | struct page *page = vmf->page; |
| 159 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 135 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; |
| 160 | struct buffer_head *di_bh = NULL; | 136 | struct buffer_head *di_bh = NULL; |
| 161 | sigset_t blocked, oldset; | 137 | sigset_t oldset; |
| 162 | int ret, ret2; | 138 | int ret; |
| 163 | 139 | ||
| 164 | ret = ocfs2_vm_op_block_sigs(&blocked, &oldset); | 140 | ocfs2_block_signals(&oldset); |
| 165 | if (ret < 0) { | ||
| 166 | mlog_errno(ret); | ||
| 167 | return ret; | ||
| 168 | } | ||
| 169 | 141 | ||
| 170 | /* | 142 | /* |
| 171 | * The cluster locks taken will block a truncate from another | 143 | * The cluster locks taken will block a truncate from another |
| @@ -193,9 +165,7 @@ static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 193 | ocfs2_inode_unlock(inode, 1); | 165 | ocfs2_inode_unlock(inode, 1); |
| 194 | 166 | ||
| 195 | out: | 167 | out: |
| 196 | ret2 = ocfs2_vm_op_unblock_sigs(&oldset); | 168 | ocfs2_unblock_signals(&oldset); |
| 197 | if (ret2 < 0) | ||
| 198 | mlog_errno(ret2); | ||
| 199 | if (ret) | 169 | if (ret) |
| 200 | ret = VM_FAULT_SIGBUS; | 170 | ret = VM_FAULT_SIGBUS; |
| 201 | return ret; | 171 | return ret; |
