Lines Matching refs:dentry
48 struct dentry *dentry, const char *acl_name) in ovl_copy_acl() argument
69 err = ovl_do_set_acl(ofs, dentry, acl_name, clone); in ovl_copy_acl()
76 int ovl_copy_xattr(struct super_block *sb, const struct path *oldpath, struct dentry *new) in ovl_copy_xattr()
78 struct dentry *old = oldpath->dentry; in ovl_copy_xattr()
185 old->dentry, err); in ovl_copy_fileattr()
196 err = ovl_set_protattr(inode, new->dentry, &oldfa); in ovl_copy_fileattr()
218 new->dentry, err); in ovl_copy_fileattr()
233 static int ovl_copy_up_file(struct ovl_fs *ofs, struct dentry *dentry, in ovl_copy_up_file() argument
246 ovl_path_lowerdata(dentry, &datapath); in ovl_copy_up_file()
247 if (WARN_ON(datapath.dentry == NULL)) in ovl_copy_up_file()
325 struct dentry *upperdentry, struct kstat *stat) in ovl_set_size()
335 static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry, in ovl_set_timestamps()
348 int ovl_set_attr(struct ovl_fs *ofs, struct dentry *upperdentry, in ovl_set_attr()
374 struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct dentry *real, in ovl_encode_real_fh()
429 int ovl_set_origin(struct ovl_fs *ofs, struct dentry *lower, in ovl_set_origin()
430 struct dentry *upper) in ovl_set_origin()
458 static int ovl_set_upper_fh(struct ovl_fs *ofs, struct dentry *upper, in ovl_set_upper_fh()
459 struct dentry *index) in ovl_set_upper_fh()
479 static int ovl_create_index(struct dentry *dentry, struct dentry *origin, in ovl_create_index() argument
480 struct dentry *upper) in ovl_create_index()
482 struct ovl_fs *ofs = OVL_FS(dentry->d_sb); in ovl_create_index()
483 struct dentry *indexdir = ovl_indexdir(dentry->d_sb); in ovl_create_index()
485 struct dentry *index = NULL; in ovl_create_index()
486 struct dentry *temp = NULL; in ovl_create_index()
498 if (WARN_ON(!d_is_dir(dentry))) in ovl_create_index()
502 if (WARN_ON(ovl_test_flag(OVL_INDEX, d_inode(dentry)))) in ovl_create_index()
535 struct dentry *parent;
536 struct dentry *dentry; member
541 struct dentry *destdir;
543 struct dentry *workdir;
553 struct dentry *upper; in ovl_link_up()
554 struct dentry *upperdir = ovl_dentry_upper(c->parent); in ovl_link_up()
555 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_link_up()
563 err = ovl_set_nlink_lower(c->dentry); in ovl_link_up()
568 upper = ovl_lookup_upper(ofs, c->dentry->d_name.name, upperdir, in ovl_link_up()
569 c->dentry->d_name.len); in ovl_link_up()
572 err = ovl_do_link(ofs, ovl_dentry_upper(c->dentry), udir, upper); in ovl_link_up()
578 ovl_dentry_set_upper_alias(c->dentry); in ovl_link_up()
579 ovl_dentry_update_reval(c->dentry, upper); in ovl_link_up()
586 err = ovl_set_nlink_upper(c->dentry); in ovl_link_up()
593 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_copy_up_data()
604 err = ovl_copy_up_file(ofs, c->dentry, new_file, c->stat.size); in ovl_copy_up_data()
610 static int ovl_copy_up_metadata(struct ovl_copy_up_ctx *c, struct dentry *temp) in ovl_copy_up_metadata()
612 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_copy_up_metadata()
613 struct inode *inode = d_inode(c->dentry); in ovl_copy_up_metadata()
614 struct path upperpath = { .mnt = ovl_upper_mnt(ofs), .dentry = temp }; in ovl_copy_up_metadata()
617 err = ovl_copy_xattr(c->dentry->d_sb, &c->lowerpath, temp); in ovl_copy_up_metadata()
640 err = ovl_set_origin(ofs, c->lowerpath.dentry, temp); in ovl_copy_up_metadata()
649 ovl_path_lowerdata(c->dentry, &lowerdatapath); in ovl_copy_up_metadata()
650 if (WARN_ON_ONCE(lowerdatapath.dentry == NULL)) in ovl_copy_up_metadata()
679 static int ovl_prep_cu_creds(struct dentry *dentry, struct ovl_cu_creds *cc) in ovl_prep_cu_creds() argument
684 err = security_inode_copy_up(dentry, &cc->new); in ovl_prep_cu_creds()
708 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_copy_up_workdir()
712 struct dentry *temp, *upper; in ovl_copy_up_workdir()
727 err = ovl_prep_cu_creds(c->dentry, &cc); in ovl_copy_up_workdir()
742 path.dentry = temp; in ovl_copy_up_workdir()
752 err = ovl_create_index(c->dentry, c->lowerpath.dentry, temp); in ovl_copy_up_workdir()
768 inode = d_inode(c->dentry); in ovl_copy_up_workdir()
794 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_copy_up_tmpfile()
796 struct dentry *temp, *upper; in ovl_copy_up_tmpfile()
801 err = ovl_prep_cu_creds(c->dentry, &cc); in ovl_copy_up_tmpfile()
811 temp = tmpfile->f_path.dentry; in ovl_copy_up_tmpfile()
813 err = ovl_copy_up_file(ofs, c->dentry, tmpfile, c->stat.size); in ovl_copy_up_tmpfile()
837 ovl_set_flag(OVL_HAS_DIGEST, d_inode(c->dentry)); in ovl_copy_up_tmpfile()
839 ovl_clear_flag(OVL_HAS_DIGEST, d_inode(c->dentry)); in ovl_copy_up_tmpfile()
840 ovl_clear_flag(OVL_VERIFIED_DIGEST, d_inode(c->dentry)); in ovl_copy_up_tmpfile()
843 ovl_set_upperdata(d_inode(c->dentry)); in ovl_copy_up_tmpfile()
844 ovl_inode_update(d_inode(c->dentry), dget(temp)); in ovl_copy_up_tmpfile()
863 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_do_copy_up()
872 if (ovl_need_index(c->dentry)) { in ovl_do_copy_up()
875 c->workdir = ovl_indexdir(c->dentry->d_sb); in ovl_do_copy_up()
884 c->destdir = ovl_indexdir(c->dentry->d_sb); in ovl_do_copy_up()
885 err = ovl_get_index_name(ofs, c->lowerpath.dentry, &c->destname); in ovl_do_copy_up()
910 ovl_set_flag(OVL_INDEX, d_inode(c->dentry)); in ovl_do_copy_up()
914 err = ovl_set_nlink_upper(c->dentry); in ovl_do_copy_up()
923 ovl_dentry_set_upper_alias(c->dentry); in ovl_do_copy_up()
924 ovl_dentry_update_reval(c->dentry, ovl_dentry_upper(c->dentry)); in ovl_do_copy_up()
933 static bool ovl_need_meta_copy_up(struct dentry *dentry, umode_t mode, in ovl_need_meta_copy_up() argument
936 struct ovl_fs *ofs = OVL_FS(dentry->d_sb); in ovl_need_meta_copy_up()
951 ovl_path_lowerdata(dentry, &lowerdata); in ovl_need_meta_copy_up()
953 if (WARN_ON_ONCE(lowerdata.dentry == NULL) || in ovl_need_meta_copy_up()
955 !fsverity_active(d_inode(lowerdata.dentry))) { in ovl_need_meta_copy_up()
989 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_copy_up_meta_inode_data()
995 ovl_path_upper(c->dentry, &upperpath); in ovl_copy_up_meta_inode_data()
996 if (WARN_ON(upperpath.dentry == NULL)) in ovl_copy_up_meta_inode_data()
1015 err = ovl_do_setxattr(ofs, upperpath.dentry, XATTR_NAME_CAPS, in ovl_copy_up_meta_inode_data()
1022 err = ovl_removexattr(ofs, upperpath.dentry, OVL_XATTR_METACOPY); in ovl_copy_up_meta_inode_data()
1026 ovl_clear_flag(OVL_HAS_DIGEST, d_inode(c->dentry)); in ovl_copy_up_meta_inode_data()
1027 ovl_clear_flag(OVL_VERIFIED_DIGEST, d_inode(c->dentry)); in ovl_copy_up_meta_inode_data()
1028 ovl_set_upperdata(d_inode(c->dentry)); in ovl_copy_up_meta_inode_data()
1035 static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, in ovl_copy_up_one() argument
1043 .dentry = dentry, in ovl_copy_up_one()
1044 .workdir = ovl_workdir(dentry), in ovl_copy_up_one()
1050 ovl_path_lower(dentry, &ctx.lowerpath); in ovl_copy_up_one()
1060 ctx.metacopy = ovl_need_meta_copy_up(dentry, ctx.stat.mode, flags); in ovl_copy_up_one()
1064 ctx.destdir = parentpath.dentry; in ovl_copy_up_one()
1065 ctx.destname = dentry->d_name; in ovl_copy_up_one()
1079 ctx.link = vfs_get_link(ctx.lowerpath.dentry, &done); in ovl_copy_up_one()
1084 err = ovl_copy_up_start(dentry, flags); in ovl_copy_up_one()
1090 if (!ovl_dentry_upper(dentry)) in ovl_copy_up_one()
1092 if (!err && parent && !ovl_dentry_has_upper_alias(dentry)) in ovl_copy_up_one()
1094 if (!err && ovl_dentry_needs_data_copy_up_locked(dentry, flags)) in ovl_copy_up_one()
1096 ovl_copy_up_end(dentry); in ovl_copy_up_one()
1103 static int ovl_copy_up_flags(struct dentry *dentry, int flags) in ovl_copy_up_flags() argument
1107 bool disconnected = (dentry->d_flags & DCACHE_DISCONNECTED); in ovl_copy_up_flags()
1114 if (WARN_ON(disconnected && d_is_dir(dentry))) in ovl_copy_up_flags()
1122 err = ovl_verify_lowerdata(dentry); in ovl_copy_up_flags()
1126 old_cred = ovl_override_creds(dentry->d_sb); in ovl_copy_up_flags()
1128 struct dentry *next; in ovl_copy_up_flags()
1129 struct dentry *parent = NULL; in ovl_copy_up_flags()
1131 if (ovl_already_copied_up(dentry, flags)) in ovl_copy_up_flags()
1134 next = dget(dentry); in ovl_copy_up_flags()
1156 static bool ovl_open_need_copy_up(struct dentry *dentry, int flags) in ovl_open_need_copy_up() argument
1159 if (ovl_already_copied_up(dentry, flags)) in ovl_open_need_copy_up()
1162 if (special_file(d_inode(dentry)->i_mode)) in ovl_open_need_copy_up()
1171 int ovl_maybe_copy_up(struct dentry *dentry, int flags) in ovl_maybe_copy_up() argument
1175 if (ovl_open_need_copy_up(dentry, flags)) { in ovl_maybe_copy_up()
1176 err = ovl_want_write(dentry); in ovl_maybe_copy_up()
1178 err = ovl_copy_up_flags(dentry, flags); in ovl_maybe_copy_up()
1179 ovl_drop_write(dentry); in ovl_maybe_copy_up()
1186 int ovl_copy_up_with_data(struct dentry *dentry) in ovl_copy_up_with_data() argument
1188 return ovl_copy_up_flags(dentry, O_WRONLY); in ovl_copy_up_with_data()
1191 int ovl_copy_up(struct dentry *dentry) in ovl_copy_up() argument
1193 return ovl_copy_up_flags(dentry, 0); in ovl_copy_up()