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