Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200177
b: refs/heads/master
c: 07f1a4f
h: refs/heads/master
i:
  200175: 48cc87b
v: v3
  • Loading branch information
Dave Chinner authored and Alex Elder committed May 28, 2010
1 parent 2184a2b commit 20f42fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fdc07f44c891d3fdee7722a03e3881614a293b3c
refs/heads/master: 07f1a4f5e89cd4e6c79d67d41e8a18c451214ae2
16 changes: 13 additions & 3 deletions trunk/fs/xfs/linux-2.6/xfs_iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,20 @@ xfs_vn_fallocate(
bf.l_len = len;

xfs_ilock(ip, XFS_IOLOCK_EXCL);

/* check the new inode size is valid before allocating */
if (!(mode & FALLOC_FL_KEEP_SIZE) &&
offset + len > i_size_read(inode)) {
new_size = offset + len;
error = inode_newsize_ok(inode, new_size);
if (error)
goto out_unlock;
}

error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
0, XFS_ATTR_NOLOCK);
if (!error && !(mode & FALLOC_FL_KEEP_SIZE) &&
offset + len > i_size_read(inode))
new_size = offset + len;
if (error)
goto out_unlock;

/* Change file size if needed */
if (new_size) {
Expand All @@ -600,6 +609,7 @@ xfs_vn_fallocate(
error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK);
}

out_unlock:
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
out_error:
return error;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/xfs/xfs_vnodeops.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ xfs_setattr(
if (code) {
ASSERT(tp == NULL);
lock_flags &= ~XFS_ILOCK_EXCL;
ASSERT(lock_flags == XFS_IOLOCK_EXCL);
ASSERT(lock_flags == XFS_IOLOCK_EXCL || !need_iolock);
goto error_return;
}
tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_SIZE);
Expand Down

0 comments on commit 20f42fa

Please sign in to comment.