hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/fs/attr.c
....@@ -114,7 +114,7 @@
114114
115115 return 0;
116116 }
117
-EXPORT_SYMBOL(setattr_prepare);
117
+EXPORT_SYMBOL_NS(setattr_prepare, ANDROID_GKI_VFS_EXPORT_ONLY);
118118
119119 /**
120120 * inode_newsize_ok - may this inode be truncated to a given size
....@@ -134,6 +134,8 @@
134134 */
135135 int inode_newsize_ok(const struct inode *inode, loff_t offset)
136136 {
137
+ if (offset < 0)
138
+ return -EINVAL;
137139 if (inode->i_size < offset) {
138140 unsigned long limit;
139141
....@@ -158,7 +160,7 @@
158160 out_big:
159161 return -EFBIG;
160162 }
161
-EXPORT_SYMBOL(inode_newsize_ok);
163
+EXPORT_SYMBOL_NS(inode_newsize_ok, ANDROID_GKI_VFS_EXPORT_ONLY);
162164
163165 /**
164166 * setattr_copy - copy simple metadata updates into the generic inode
....@@ -184,14 +186,11 @@
184186 if (ia_valid & ATTR_GID)
185187 inode->i_gid = attr->ia_gid;
186188 if (ia_valid & ATTR_ATIME)
187
- inode->i_atime = timespec64_trunc(attr->ia_atime,
188
- inode->i_sb->s_time_gran);
189
+ inode->i_atime = attr->ia_atime;
189190 if (ia_valid & ATTR_MTIME)
190
- inode->i_mtime = timespec64_trunc(attr->ia_mtime,
191
- inode->i_sb->s_time_gran);
191
+ inode->i_mtime = attr->ia_mtime;
192192 if (ia_valid & ATTR_CTIME)
193
- inode->i_ctime = timespec64_trunc(attr->ia_ctime,
194
- inode->i_sb->s_time_gran);
193
+ inode->i_ctime = attr->ia_ctime;
195194 if (ia_valid & ATTR_MODE) {
196195 umode_t mode = attr->ia_mode;
197196
....@@ -223,7 +222,7 @@
223222 * the file open for write, as there can be no conflicting delegation in
224223 * that case.
225224 */
226
-int notify_change2(struct vfsmount *mnt, struct dentry * dentry, struct iattr * attr, struct inode **delegated_inode)
225
+int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **delegated_inode)
227226 {
228227 struct inode *inode = dentry->d_inode;
229228 umode_t mode = inode->i_mode;
....@@ -247,7 +246,7 @@
247246 return -EPERM;
248247
249248 if (!inode_owner_or_capable(inode)) {
250
- error = inode_permission2(mnt, inode, MAY_WRITE);
249
+ error = inode_permission(inode, MAY_WRITE);
251250 if (error)
252251 return error;
253252 }
....@@ -265,8 +264,13 @@
265264 attr->ia_ctime = now;
266265 if (!(ia_valid & ATTR_ATIME_SET))
267266 attr->ia_atime = now;
267
+ else
268
+ attr->ia_atime = timestamp_truncate(attr->ia_atime, inode);
268269 if (!(ia_valid & ATTR_MTIME_SET))
269270 attr->ia_mtime = now;
271
+ else
272
+ attr->ia_mtime = timestamp_truncate(attr->ia_mtime, inode);
273
+
270274 if (ia_valid & ATTR_KILL_PRIV) {
271275 error = security_inode_need_killpriv(dentry);
272276 if (error < 0)
....@@ -330,9 +334,7 @@
330334 if (error)
331335 return error;
332336
333
- if (mnt && inode->i_op->setattr2)
334
- error = inode->i_op->setattr2(mnt, dentry, attr);
335
- else if (inode->i_op->setattr)
337
+ if (inode->i_op->setattr)
336338 error = inode->i_op->setattr(dentry, attr);
337339 else
338340 error = simple_setattr(dentry, attr);
....@@ -345,10 +347,4 @@
345347
346348 return error;
347349 }
348
-EXPORT_SYMBOL(notify_change2);
349
-
350
-int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **delegated_inode)
351
-{
352
- return notify_change2(NULL, dentry, attr, delegated_inode);
353
-}
354
-EXPORT_SYMBOL(notify_change);
350
+EXPORT_SYMBOL_NS(notify_change, ANDROID_GKI_VFS_EXPORT_ONLY);