hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/ocfs2/file.c
....@@ -1994,7 +1994,7 @@
19941994 }
19951995 }
19961996
1997
- if (file && should_remove_suid(file->f_path.dentry)) {
1997
+ if (file && setattr_should_drop_suidgid(file_inode(file))) {
19981998 ret = __ocfs2_write_remove_suid(inode, di_bh);
19991999 if (ret) {
20002000 mlog_errno(ret);
....@@ -2103,14 +2103,20 @@
21032103 struct ocfs2_space_resv sr;
21042104 int change_size = 1;
21052105 int cmd = OCFS2_IOC_RESVSP64;
2106
+ int ret = 0;
21062107
21072108 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
21082109 return -EOPNOTSUPP;
21092110 if (!ocfs2_writes_unwritten_extents(osb))
21102111 return -EOPNOTSUPP;
21112112
2112
- if (mode & FALLOC_FL_KEEP_SIZE)
2113
+ if (mode & FALLOC_FL_KEEP_SIZE) {
21132114 change_size = 0;
2115
+ } else {
2116
+ ret = inode_newsize_ok(inode, offset + len);
2117
+ if (ret)
2118
+ return ret;
2119
+ }
21142120
21152121 if (mode & FALLOC_FL_PUNCH_HOLE)
21162122 cmd = OCFS2_IOC_UNRESVSP64;
....@@ -2282,7 +2288,7 @@
22822288 * inode. There's also the dinode i_size state which
22832289 * can be lost via setattr during extending writes (we
22842290 * set inode->i_size at the end of a write. */
2285
- if (should_remove_suid(dentry)) {
2291
+ if (setattr_should_drop_suidgid(inode)) {
22862292 if (meta_level == 0) {
22872293 ocfs2_inode_unlock_for_extent_tree(inode,
22882294 &di_bh,