diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index f7672472fa82..6d5ffa803b31 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c @@ -793,8 +793,10 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, phys_bytes = le64_to_cpu(rec.e_blkno) << osb->sb->s_blocksize_bits; virt_bytes = (u64)le32_to_cpu(rec.e_cpos) << osb->s_clustersize_bits; + up_read(&OCFS2_I(inode)->ip_alloc_sem); ret = fiemap_fill_next_extent(fieinfo, virt_bytes, phys_bytes, len_bytes, fe_flags); + down_read(&OCFS2_I(inode)->ip_alloc_sem); if (ret) break; diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 6ef4cb045ccd..f7863f7fb4a1 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c @@ -119,9 +119,6 @@ static vm_fault_t ocfs2_page_mkwrite(struct vm_fault *vmf) int err; vm_fault_t ret; - sb_start_pagefault(inode->i_sb); - ocfs2_block_signals(&oldset); - /* * The cluster locks taken will block a truncate from another * node. Taking the data lock will also ensure that we don't @@ -131,7 +128,7 @@ static vm_fault_t ocfs2_page_mkwrite(struct vm_fault *vmf) if (err < 0) { mlog_errno(err); ret = vmf_error(err); - goto out; + return ret; } /* @@ -141,16 +138,19 @@ static vm_fault_t ocfs2_page_mkwrite(struct vm_fault *vmf) */ down_write(&OCFS2_I(inode)->ip_alloc_sem); + sb_start_pagefault(inode->i_sb); + ocfs2_block_signals(&oldset); + ret = __ocfs2_page_mkwrite(vmf->vma->vm_file, di_bh, page); + ocfs2_unblock_signals(&oldset); + sb_end_pagefault(inode->i_sb); + up_write(&OCFS2_I(inode)->ip_alloc_sem); brelse(di_bh); ocfs2_inode_unlock(inode, 1); -out: - ocfs2_unblock_signals(&oldset); - sb_end_pagefault(inode->i_sb); return ret; }