aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_file.c5
-rw-r--r--fs/xfs/xfs_ioctl.c5
-rw-r--r--fs/xfs/xfs_iops.c10
-rw-r--r--fs/xfs/xfs_pnfs.c3
4 files changed, 11 insertions, 12 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 299aee4b7b0b..35309bd046be 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -734,7 +734,7 @@ xfs_file_fallocate(
734 struct xfs_inode *ip = XFS_I(inode); 734 struct xfs_inode *ip = XFS_I(inode);
735 long error; 735 long error;
736 enum xfs_prealloc_flags flags = 0; 736 enum xfs_prealloc_flags flags = 0;
737 uint iolock = XFS_IOLOCK_EXCL; 737 uint iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL;
738 loff_t new_size = 0; 738 loff_t new_size = 0;
739 bool do_file_insert = false; 739 bool do_file_insert = false;
740 740
@@ -748,9 +748,6 @@ xfs_file_fallocate(
748 if (error) 748 if (error)
749 goto out_unlock; 749 goto out_unlock;
750 750
751 xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
752 iolock |= XFS_MMAPLOCK_EXCL;
753
754 if (mode & FALLOC_FL_PUNCH_HOLE) { 751 if (mode & FALLOC_FL_PUNCH_HOLE) {
755 error = xfs_free_file_space(ip, offset, len); 752 error = xfs_free_file_space(ip, offset, len);
756 if (error) 753 if (error)
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 89fb1eb80aae..4151fade4bb1 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -614,7 +614,7 @@ xfs_ioc_space(
614 struct xfs_inode *ip = XFS_I(inode); 614 struct xfs_inode *ip = XFS_I(inode);
615 struct iattr iattr; 615 struct iattr iattr;
616 enum xfs_prealloc_flags flags = 0; 616 enum xfs_prealloc_flags flags = 0;
617 uint iolock = XFS_IOLOCK_EXCL; 617 uint iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL;
618 int error; 618 int error;
619 619
620 /* 620 /*
@@ -648,9 +648,6 @@ xfs_ioc_space(
648 if (error) 648 if (error)
649 goto out_unlock; 649 goto out_unlock;
650 650
651 xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
652 iolock |= XFS_MMAPLOCK_EXCL;
653
654 switch (bf->l_whence) { 651 switch (bf->l_whence) {
655 case 0: /*SEEK_SET*/ 652 case 0: /*SEEK_SET*/
656 break; 653 break;
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index a3ed3c811dfa..138fb36ca875 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -1031,13 +1031,17 @@ xfs_vn_setattr(
1031 1031
1032 if (iattr->ia_valid & ATTR_SIZE) { 1032 if (iattr->ia_valid & ATTR_SIZE) {
1033 struct xfs_inode *ip = XFS_I(d_inode(dentry)); 1033 struct xfs_inode *ip = XFS_I(d_inode(dentry));
1034 uint iolock = XFS_IOLOCK_EXCL; 1034 uint iolock;
1035
1036 xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
1037 iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL;
1035 1038
1036 error = xfs_break_layouts(d_inode(dentry), &iolock); 1039 error = xfs_break_layouts(d_inode(dentry), &iolock);
1037 if (error) 1040 if (error) {
1041 xfs_iunlock(ip, XFS_MMAPLOCK_EXCL);
1038 return error; 1042 return error;
1043 }
1039 1044
1040 xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
1041 error = xfs_vn_setattr_size(dentry, iattr); 1045 error = xfs_vn_setattr_size(dentry, iattr);
1042 xfs_iunlock(ip, XFS_MMAPLOCK_EXCL); 1046 xfs_iunlock(ip, XFS_MMAPLOCK_EXCL);
1043 } else { 1047 } else {
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
index aa6c5c193f45..6ea7b0b55d02 100644
--- a/fs/xfs/xfs_pnfs.c
+++ b/fs/xfs/xfs_pnfs.c
@@ -43,7 +43,8 @@ xfs_break_layouts(
43 while ((error = break_layout(inode, false) == -EWOULDBLOCK)) { 43 while ((error = break_layout(inode, false) == -EWOULDBLOCK)) {
44 xfs_iunlock(ip, *iolock); 44 xfs_iunlock(ip, *iolock);
45 error = break_layout(inode, true); 45 error = break_layout(inode, true);
46 *iolock = XFS_IOLOCK_EXCL; 46 *iolock &= ~XFS_IOLOCK_SHARED;
47 *iolock |= XFS_IOLOCK_EXCL;
47 xfs_ilock(ip, *iolock); 48 xfs_ilock(ip, *iolock);
48 } 49 }
49 50