hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/fs/xfs/xfs_file.c
....@@ -94,8 +94,6 @@
9494 ip->i_d.di_flags &= ~XFS_DIFLAG_PREALLOC;
9595
9696 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
97
- if (flags & XFS_PREALLOC_SYNC)
98
- xfs_trans_set_sync(tp);
9997 return xfs_trans_commit(tp);
10098 }
10199
....@@ -852,7 +850,6 @@
852850 struct inode *inode = file_inode(file);
853851 struct xfs_inode *ip = XFS_I(inode);
854852 long error;
855
- enum xfs_prealloc_flags flags = 0;
856853 uint iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL;
857854 loff_t new_size = 0;
858855 bool do_file_insert = false;
....@@ -896,6 +893,10 @@
896893 if (error)
897894 goto out_unlock;
898895 }
896
+
897
+ error = file_modified(file);
898
+ if (error)
899
+ goto out_unlock;
899900
900901 if (mode & FALLOC_FL_PUNCH_HOLE) {
901902 error = xfs_free_file_space(ip, offset, len);
....@@ -946,8 +947,6 @@
946947 }
947948 do_file_insert = true;
948949 } else {
949
- flags |= XFS_PREALLOC_SET;
950
-
951950 if (!(mode & FALLOC_FL_KEEP_SIZE) &&
952951 offset + len > i_size_read(inode)) {
953952 new_size = offset + len;
....@@ -1000,13 +999,6 @@
1000999 }
10011000 }
10021001
1003
- if (file->f_flags & O_DSYNC)
1004
- flags |= XFS_PREALLOC_SYNC;
1005
-
1006
- error = xfs_update_prealloc_flags(ip, flags);
1007
- if (error)
1008
- goto out_unlock;
1009
-
10101002 /* Change file size if needed */
10111003 if (new_size) {
10121004 struct iattr iattr;
....@@ -1024,8 +1016,14 @@
10241016 * leave shifted extents past EOF and hence losing access to
10251017 * the data that is contained within them.
10261018 */
1027
- if (do_file_insert)
1019
+ if (do_file_insert) {
10281020 error = xfs_insert_file_space(ip, offset, len);
1021
+ if (error)
1022
+ goto out_unlock;
1023
+ }
1024
+
1025
+ if (file->f_flags & O_DSYNC)
1026
+ error = xfs_log_force_inode(ip);
10291027
10301028 out_unlock:
10311029 xfs_iunlock(ip, iolock);