diff options
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 16 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 9c8019c78c92..44f0b2de153e 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -585,11 +585,20 @@ xfs_vn_fallocate( | |||
585 | bf.l_len = len; | 585 | bf.l_len = len; |
586 | 586 | ||
587 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 587 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
588 | |||
589 | /* check the new inode size is valid before allocating */ | ||
590 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | ||
591 | offset + len > i_size_read(inode)) { | ||
592 | new_size = offset + len; | ||
593 | error = inode_newsize_ok(inode, new_size); | ||
594 | if (error) | ||
595 | goto out_unlock; | ||
596 | } | ||
597 | |||
588 | error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, | 598 | error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, |
589 | 0, XFS_ATTR_NOLOCK); | 599 | 0, XFS_ATTR_NOLOCK); |
590 | if (!error && !(mode & FALLOC_FL_KEEP_SIZE) && | 600 | if (error) |
591 | offset + len > i_size_read(inode)) | 601 | goto out_unlock; |
592 | new_size = offset + len; | ||
593 | 602 | ||
594 | /* Change file size if needed */ | 603 | /* Change file size if needed */ |
595 | if (new_size) { | 604 | if (new_size) { |
@@ -600,6 +609,7 @@ xfs_vn_fallocate( | |||
600 | error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK); | 609 | error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK); |
601 | } | 610 | } |
602 | 611 | ||
612 | out_unlock: | ||
603 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 613 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
604 | out_error: | 614 | out_error: |
605 | return error; | 615 | return error; |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 9d376be0ea38..a06bd62504fc 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -267,7 +267,7 @@ xfs_setattr( | |||
267 | if (code) { | 267 | if (code) { |
268 | ASSERT(tp == NULL); | 268 | ASSERT(tp == NULL); |
269 | lock_flags &= ~XFS_ILOCK_EXCL; | 269 | lock_flags &= ~XFS_ILOCK_EXCL; |
270 | ASSERT(lock_flags == XFS_IOLOCK_EXCL); | 270 | ASSERT(lock_flags == XFS_IOLOCK_EXCL || !need_iolock); |
271 | goto error_return; | 271 | goto error_return; |
272 | } | 272 | } |
273 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_SIZE); | 273 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_SIZE); |