summaryrefslogtreecommitdiff
path: root/fs/ocfs2/refcounttree.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-07-29 00:11:28 +0400
committerH. Peter Anvin <hpa@linux.intel.com>2010-07-29 00:11:28 +0400
commit7d50d07da23995a18ac449636cb42aec2cb2808d (patch)
tree0ddf940a5e9ddc5eeebc996601d7fee3c36ab836 /fs/ocfs2/refcounttree.c
parent2decb194e65ab66eaf787512dc572cdc99893b24 (diff)
parent6aa033d7efb85830535bb83cf6713d6025ae6e59 (diff)
downloadlinux-7d50d07da23995a18ac449636cb42aec2cb2808d.tar.xz
Merge remote branch 'linus/master' into x86/cpu
Diffstat (limited to 'fs/ocfs2/refcounttree.c')
-rw-r--r--fs/ocfs2/refcounttree.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 4793f36f6518..3ac5aa733e9c 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -2931,6 +2931,12 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle,
offset = ((loff_t)cpos) << OCFS2_SB(sb)->s_clustersize_bits;
end = offset + (new_len << OCFS2_SB(sb)->s_clustersize_bits);
+ /*
+ * We only duplicate pages until we reach the page contains i_size - 1.
+ * So trim 'end' to i_size.
+ */
+ if (end > i_size_read(context->inode))
+ end = i_size_read(context->inode);
while (offset < end) {
page_index = offset >> PAGE_CACHE_SHIFT;
@@ -4166,6 +4172,12 @@ static int __ocfs2_reflink(struct dentry *old_dentry,
struct inode *inode = old_dentry->d_inode;
struct buffer_head *new_bh = NULL;
+ if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) {
+ ret = -EINVAL;
+ mlog_errno(ret);
+ goto out;
+ }
+
ret = filemap_fdatawrite(inode->i_mapping);
if (ret) {
mlog_errno(ret);