Lines Matching refs:kattr

3970 static unsigned int recalc_flags(struct mount_kattr *kattr, struct mount *mnt)  in recalc_flags()  argument
3975 flags &= ~kattr->attr_clr; in recalc_flags()
3977 flags |= kattr->attr_set; in recalc_flags()
3982 static int can_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt) in can_idmap_mount() argument
3987 if (!kattr->mnt_idmap) in can_idmap_mount()
3994 if (!check_fsmapping(kattr->mnt_idmap, m->mnt_sb)) in can_idmap_mount()
4029 static inline bool mnt_allow_writers(const struct mount_kattr *kattr, in mnt_allow_writers() argument
4032 return (!(kattr->attr_set & MNT_READONLY) || in mnt_allow_writers()
4034 !kattr->mnt_idmap; in mnt_allow_writers()
4037 static int mount_setattr_prepare(struct mount_kattr *kattr, struct mount *mnt) in mount_setattr_prepare() argument
4043 if (!can_change_locked_flags(m, recalc_flags(kattr, m))) { in mount_setattr_prepare()
4048 err = can_idmap_mount(kattr, m); in mount_setattr_prepare()
4052 if (!mnt_allow_writers(kattr, m)) { in mount_setattr_prepare()
4058 if (!kattr->recurse) in mount_setattr_prepare()
4086 static void do_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt) in do_idmap_mount() argument
4088 if (!kattr->mnt_idmap) in do_idmap_mount()
4099 smp_store_release(&mnt->mnt.mnt_idmap, mnt_idmap_get(kattr->mnt_idmap)); in do_idmap_mount()
4102 static void mount_setattr_commit(struct mount_kattr *kattr, struct mount *mnt) in mount_setattr_commit() argument
4109 do_idmap_mount(kattr, m); in mount_setattr_commit()
4110 flags = recalc_flags(kattr, m); in mount_setattr_commit()
4117 if (kattr->propagation) in mount_setattr_commit()
4118 change_mnt_propagation(m, kattr->propagation); in mount_setattr_commit()
4119 if (!kattr->recurse) in mount_setattr_commit()
4125 static int do_mount_setattr(struct path *path, struct mount_kattr *kattr) in do_mount_setattr() argument
4133 if (kattr->mnt_userns) { in do_mount_setattr()
4136 mnt_idmap = alloc_mnt_idmap(kattr->mnt_userns); in do_mount_setattr()
4139 kattr->mnt_idmap = mnt_idmap; in do_mount_setattr()
4142 if (kattr->propagation) { in do_mount_setattr()
4148 if (kattr->propagation == MS_SHARED) { in do_mount_setattr()
4149 err = invent_group_ids(mnt, kattr->recurse); in do_mount_setattr()
4178 err = mount_setattr_prepare(kattr, mnt); in do_mount_setattr()
4180 mount_setattr_commit(kattr, mnt); in do_mount_setattr()
4185 if (kattr->propagation) { in do_mount_setattr()
4195 struct mount_kattr *kattr, unsigned int flags) in build_mount_idmapped() argument
4251 kattr->mnt_userns = get_user_ns(mnt_userns); in build_mount_idmapped()
4259 struct mount_kattr *kattr, unsigned int flags) in build_mount_kattr() argument
4270 *kattr = (struct mount_kattr) { in build_mount_kattr()
4279 kattr->propagation = attr->propagation; in build_mount_kattr()
4284 kattr->attr_set = attr_flags_to_mnt_flags(attr->attr_set); in build_mount_kattr()
4285 kattr->attr_clr = attr_flags_to_mnt_flags(attr->attr_clr); in build_mount_kattr()
4304 kattr->attr_clr |= MNT_RELATIME | MNT_NOATIME; in build_mount_kattr()
4307 kattr->attr_set |= MNT_RELATIME; in build_mount_kattr()
4310 kattr->attr_set |= MNT_NOATIME; in build_mount_kattr()
4322 return build_mount_idmapped(attr, usize, kattr, flags); in build_mount_kattr()
4325 static void finish_mount_kattr(struct mount_kattr *kattr) in finish_mount_kattr() argument
4327 put_user_ns(kattr->mnt_userns); in finish_mount_kattr()
4328 kattr->mnt_userns = NULL; in finish_mount_kattr()
4330 if (kattr->mnt_idmap) in finish_mount_kattr()
4331 mnt_idmap_put(kattr->mnt_idmap); in finish_mount_kattr()
4341 struct mount_kattr kattr; in SYSCALL_DEFINE5() local
4369 err = build_mount_kattr(&attr, usize, &kattr, flags); in SYSCALL_DEFINE5()
4373 err = user_path_at(dfd, path, kattr.lookup_flags, &target); in SYSCALL_DEFINE5()
4375 err = do_mount_setattr(&target, &kattr); in SYSCALL_DEFINE5()
4378 finish_mount_kattr(&kattr); in SYSCALL_DEFINE5()