Lines Matching refs:inode
34 const struct inode *inode) in setattr_should_drop_sgid() argument
36 umode_t mode = inode->i_mode; in setattr_should_drop_sgid()
42 if (!in_group_or_capable(idmap, inode, i_gid_into_vfsgid(idmap, inode))) in setattr_should_drop_sgid()
64 struct inode *inode) in setattr_should_drop_suidgid() argument
66 umode_t mode = inode->i_mode; in setattr_should_drop_suidgid()
73 kill |= setattr_should_drop_sgid(idmap, inode); in setattr_should_drop_suidgid()
95 const struct inode *inode, vfsuid_t ia_vfsuid) in chown_ok() argument
97 vfsuid_t vfsuid = i_uid_into_vfsuid(idmap, inode); in chown_ok()
101 if (capable_wrt_inode_uidgid(idmap, inode, CAP_CHOWN)) in chown_ok()
104 ns_capable(inode->i_sb->s_user_ns, CAP_CHOWN)) in chown_ok()
122 const struct inode *inode, vfsgid_t ia_vfsgid) in chgrp_ok() argument
124 vfsgid_t vfsgid = i_gid_into_vfsgid(idmap, inode); in chgrp_ok()
125 vfsuid_t vfsuid = i_uid_into_vfsuid(idmap, inode); in chgrp_ok()
132 if (capable_wrt_inode_uidgid(idmap, inode, CAP_CHOWN)) in chgrp_ok()
135 ns_capable(inode->i_sb->s_user_ns, CAP_CHOWN)) in chgrp_ok()
164 struct inode *inode = d_inode(dentry); in setattr_prepare() local
179 if (IS_VERITY(inode)) in setattr_prepare()
182 error = inode_newsize_ok(inode, attr->ia_size); in setattr_prepare()
193 !chown_ok(idmap, inode, attr->ia_vfsuid)) in setattr_prepare()
198 !chgrp_ok(idmap, inode, attr->ia_vfsgid)) in setattr_prepare()
205 if (!inode_owner_or_capable(idmap, inode)) in setattr_prepare()
211 vfsgid = i_gid_into_vfsgid(idmap, inode); in setattr_prepare()
214 if (!in_group_or_capable(idmap, inode, vfsgid)) in setattr_prepare()
220 if (!inode_owner_or_capable(idmap, inode)) in setattr_prepare()
254 int inode_newsize_ok(const struct inode *inode, loff_t offset) in inode_newsize_ok() argument
258 if (inode->i_size < offset) { in inode_newsize_ok()
264 if (offset > inode->i_sb->s_maxbytes) in inode_newsize_ok()
272 if (IS_SWAPFILE(inode)) in inode_newsize_ok()
294 static void setattr_copy_mgtime(struct inode *inode, const struct iattr *attr) in setattr_copy_mgtime() argument
300 now = inode_set_ctime_deleg(inode, attr->ia_ctime); in setattr_copy_mgtime()
302 now = inode_set_ctime_current(inode); in setattr_copy_mgtime()
304 now = current_time(inode); in setattr_copy_mgtime()
307 inode_set_atime_to_ts(inode, attr->ia_atime); in setattr_copy_mgtime()
309 inode_set_atime_to_ts(inode, now); in setattr_copy_mgtime()
312 inode_set_mtime_to_ts(inode, attr->ia_mtime); in setattr_copy_mgtime()
314 inode_set_mtime_to_ts(inode, now); in setattr_copy_mgtime()
342 void setattr_copy(struct mnt_idmap *idmap, struct inode *inode, in setattr_copy() argument
347 i_uid_update(idmap, attr, inode); in setattr_copy()
348 i_gid_update(idmap, attr, inode); in setattr_copy()
351 if (!in_group_or_capable(idmap, inode, in setattr_copy()
352 i_gid_into_vfsgid(idmap, inode))) in setattr_copy()
354 inode->i_mode = mode; in setattr_copy()
357 if (is_mgtime(inode)) in setattr_copy()
358 return setattr_copy_mgtime(inode, attr); in setattr_copy()
361 inode_set_atime_to_ts(inode, attr->ia_atime); in setattr_copy()
363 inode_set_mtime_to_ts(inode, attr->ia_mtime); in setattr_copy()
366 inode_set_ctime_deleg(inode, attr->ia_ctime); in setattr_copy()
368 inode_set_ctime_to_ts(inode, attr->ia_ctime); in setattr_copy()
372 int may_setattr(struct mnt_idmap *idmap, struct inode *inode, in may_setattr() argument
378 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) in may_setattr()
387 if (IS_IMMUTABLE(inode)) in may_setattr()
390 if (!inode_owner_or_capable(idmap, inode)) { in may_setattr()
391 error = inode_permission(idmap, inode, MAY_WRITE); in may_setattr()
430 struct inode *inode = dentry->d_inode; in notify_change() local
431 umode_t mode = inode->i_mode; in notify_change()
436 WARN_ON_ONCE(!inode_is_locked(inode)); in notify_change()
438 error = may_setattr(idmap, inode, ia_valid); in notify_change()
457 if (S_ISLNK(inode->i_mode)) in notify_change()
462 inode->i_flags &= ~S_NOSEC; in notify_change()
465 now = current_time(inode); in notify_change()
468 attr->ia_atime = timestamp_truncate(attr->ia_atime, inode); in notify_change()
472 attr->ia_ctime = timestamp_truncate(attr->ia_ctime, inode); in notify_change()
476 attr->ia_mtime = timestamp_truncate(attr->ia_mtime, inode); in notify_change()
502 attr->ia_mode = (inode->i_mode & ~S_ISUID); in notify_change()
509 attr->ia_mode = inode->i_mode; in notify_change()
522 !vfsuid_has_fsmapping(idmap, inode->i_sb->s_user_ns, in notify_change()
526 !vfsgid_has_fsmapping(idmap, inode->i_sb->s_user_ns, in notify_change()
534 !vfsuid_valid(i_uid_into_vfsuid(idmap, inode))) in notify_change()
537 !vfsgid_valid(i_gid_into_vfsgid(idmap, inode))) in notify_change()
550 error = try_break_deleg(inode, 0, delegated_inode); in notify_change()
555 if (inode->i_op->setattr) in notify_change()
556 error = inode->i_op->setattr(idmap, dentry, attr); in notify_change()