Skip to content

Commit

Permalink
ocfs2: take inode lock when get clusters
Browse files Browse the repository at this point in the history
We need take inode lock when calling ocfs2_get_clusters.
And use GFP_NOFS instead of GFP_KERNEL.

Signed-off-by: Joseph Qi <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
josephhz authored and torvalds committed Apr 14, 2015
1 parent 7e9b195 commit 37a8d89
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fs/ocfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,20 +772,29 @@ static ssize_t ocfs2_direct_IO_write(struct kiocb *iocb,
u32 p_cpos = 0;
u32 v_cpos = ocfs2_bytes_to_clusters(osb->sb, offset);

ret = ocfs2_inode_lock(inode, NULL, 0);
if (ret < 0) {
mlog_errno(ret);
goto clean_orphan;
}

ret = ocfs2_get_clusters(inode, v_cpos, &p_cpos,
&num_clusters, &ext_flags);
if (ret < 0) {
mlog_errno(ret);
ocfs2_inode_unlock(inode, 0);
goto clean_orphan;
}

BUG_ON(!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN));

ret = blkdev_issue_zeroout(osb->sb->s_bdev,
p_cpos << (osb->s_clustersize_bits - 9),
zero_len >> 9, GFP_KERNEL, false);
zero_len >> 9, GFP_NOFS, false);
if (ret < 0)
mlog_errno(ret);

ocfs2_inode_unlock(inode, 0);
}

clean_orphan:
Expand Down

0 comments on commit 37a8d89

Please sign in to comment.