Skip to content

Commit

Permalink
ocfs2: check ia_size limits in setattr
Browse files Browse the repository at this point in the history
We have to manually check the requested truncate size as the check in
vmtruncate() comes too late for Ocfs2.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
  • Loading branch information
Mark Fasheh committed Aug 10, 2007
1 parent 7c08d70 commit ce76fd3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
}

if (size_change && attr->ia_size != i_size_read(inode)) {
if (attr->ia_size > sb->s_maxbytes) {
status = -EFBIG;
goto bail_unlock;
}

if (i_size_read(inode) > attr->ia_size)
status = ocfs2_truncate_file(inode, bh, attr->ia_size);
else
Expand Down

0 comments on commit ce76fd3

Please sign in to comment.