| .. | .. |
|---|
| 114 | 114 | |
|---|
| 115 | 115 | return 0; |
|---|
| 116 | 116 | } |
|---|
| 117 | | -EXPORT_SYMBOL(setattr_prepare); |
|---|
| 117 | +EXPORT_SYMBOL_NS(setattr_prepare, ANDROID_GKI_VFS_EXPORT_ONLY); |
|---|
| 118 | 118 | |
|---|
| 119 | 119 | /** |
|---|
| 120 | 120 | * inode_newsize_ok - may this inode be truncated to a given size |
|---|
| .. | .. |
|---|
| 134 | 134 | */ |
|---|
| 135 | 135 | int inode_newsize_ok(const struct inode *inode, loff_t offset) |
|---|
| 136 | 136 | { |
|---|
| 137 | + if (offset < 0) |
|---|
| 138 | + return -EINVAL; |
|---|
| 137 | 139 | if (inode->i_size < offset) { |
|---|
| 138 | 140 | unsigned long limit; |
|---|
| 139 | 141 | |
|---|
| .. | .. |
|---|
| 158 | 160 | out_big: |
|---|
| 159 | 161 | return -EFBIG; |
|---|
| 160 | 162 | } |
|---|
| 161 | | -EXPORT_SYMBOL(inode_newsize_ok); |
|---|
| 163 | +EXPORT_SYMBOL_NS(inode_newsize_ok, ANDROID_GKI_VFS_EXPORT_ONLY); |
|---|
| 162 | 164 | |
|---|
| 163 | 165 | /** |
|---|
| 164 | 166 | * setattr_copy - copy simple metadata updates into the generic inode |
|---|
| .. | .. |
|---|
| 184 | 186 | if (ia_valid & ATTR_GID) |
|---|
| 185 | 187 | inode->i_gid = attr->ia_gid; |
|---|
| 186 | 188 | 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; |
|---|
| 189 | 190 | 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; |
|---|
| 192 | 192 | 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; |
|---|
| 195 | 194 | if (ia_valid & ATTR_MODE) { |
|---|
| 196 | 195 | umode_t mode = attr->ia_mode; |
|---|
| 197 | 196 | |
|---|
| .. | .. |
|---|
| 223 | 222 | * the file open for write, as there can be no conflicting delegation in |
|---|
| 224 | 223 | * that case. |
|---|
| 225 | 224 | */ |
|---|
| 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) |
|---|
| 227 | 226 | { |
|---|
| 228 | 227 | struct inode *inode = dentry->d_inode; |
|---|
| 229 | 228 | umode_t mode = inode->i_mode; |
|---|
| .. | .. |
|---|
| 247 | 246 | return -EPERM; |
|---|
| 248 | 247 | |
|---|
| 249 | 248 | if (!inode_owner_or_capable(inode)) { |
|---|
| 250 | | - error = inode_permission2(mnt, inode, MAY_WRITE); |
|---|
| 249 | + error = inode_permission(inode, MAY_WRITE); |
|---|
| 251 | 250 | if (error) |
|---|
| 252 | 251 | return error; |
|---|
| 253 | 252 | } |
|---|
| .. | .. |
|---|
| 265 | 264 | attr->ia_ctime = now; |
|---|
| 266 | 265 | if (!(ia_valid & ATTR_ATIME_SET)) |
|---|
| 267 | 266 | attr->ia_atime = now; |
|---|
| 267 | + else |
|---|
| 268 | + attr->ia_atime = timestamp_truncate(attr->ia_atime, inode); |
|---|
| 268 | 269 | if (!(ia_valid & ATTR_MTIME_SET)) |
|---|
| 269 | 270 | attr->ia_mtime = now; |
|---|
| 271 | + else |
|---|
| 272 | + attr->ia_mtime = timestamp_truncate(attr->ia_mtime, inode); |
|---|
| 273 | + |
|---|
| 270 | 274 | if (ia_valid & ATTR_KILL_PRIV) { |
|---|
| 271 | 275 | error = security_inode_need_killpriv(dentry); |
|---|
| 272 | 276 | if (error < 0) |
|---|
| .. | .. |
|---|
| 330 | 334 | if (error) |
|---|
| 331 | 335 | return error; |
|---|
| 332 | 336 | |
|---|
| 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) |
|---|
| 336 | 338 | error = inode->i_op->setattr(dentry, attr); |
|---|
| 337 | 339 | else |
|---|
| 338 | 340 | error = simple_setattr(dentry, attr); |
|---|
| .. | .. |
|---|
| 345 | 347 | |
|---|
| 346 | 348 | return error; |
|---|
| 347 | 349 | } |
|---|
| 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); |
|---|