mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
ocfs2: fix page zeroing during simple extends
The page zeroing code was missing the region between old i_size and new i_size for those extends that didn't actually require a change in space allocation. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
This commit is contained in:
parent
711a40fcaa
commit
0effef776f
1 changed files with 24 additions and 20 deletions
|
|
@ -728,31 +728,36 @@ static int ocfs2_extend_file(struct inode *inode,
|
||||||
clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size) -
|
clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size) -
|
||||||
OCFS2_I(inode)->ip_clusters;
|
OCFS2_I(inode)->ip_clusters;
|
||||||
|
|
||||||
if (clusters_to_add) {
|
/*
|
||||||
/*
|
* protect the pages that ocfs2_zero_extend is going to be
|
||||||
* protect the pages that ocfs2_zero_extend is going to
|
* pulling into the page cache.. we do this before the
|
||||||
* be pulling into the page cache.. we do this before the
|
* metadata extend so that we don't get into the situation
|
||||||
* metadata extend so that we don't get into the situation
|
* where we've extended the metadata but can't get the data
|
||||||
* where we've extended the metadata but can't get the data
|
* lock to zero.
|
||||||
* lock to zero.
|
*/
|
||||||
*/
|
ret = ocfs2_data_lock(inode, 1);
|
||||||
ret = ocfs2_data_lock(inode, 1);
|
if (ret < 0) {
|
||||||
if (ret < 0) {
|
mlog_errno(ret);
|
||||||
mlog_errno(ret);
|
goto out;
|
||||||
goto out;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (clusters_to_add) {
|
||||||
ret = ocfs2_extend_allocation(inode, clusters_to_add);
|
ret = ocfs2_extend_allocation(inode, clusters_to_add);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
mlog_errno(ret);
|
mlog_errno(ret);
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip);
|
/*
|
||||||
if (ret < 0) {
|
* Call this even if we don't add any clusters to the tree. We
|
||||||
mlog_errno(ret);
|
* still need to zero the area between the old i_size and the
|
||||||
goto out_unlock;
|
* new i_size.
|
||||||
}
|
*/
|
||||||
|
ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip);
|
||||||
|
if (ret < 0) {
|
||||||
|
mlog_errno(ret);
|
||||||
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tail_to_skip) {
|
if (!tail_to_skip) {
|
||||||
|
|
@ -764,8 +769,7 @@ static int ocfs2_extend_file(struct inode *inode,
|
||||||
}
|
}
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
if (clusters_to_add) /* this is the only case in which we lock */
|
ocfs2_data_unlock(inode, 1);
|
||||||
ocfs2_data_unlock(inode, 1);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue