Lines Matching refs:dentry

47 int ovl_copy_xattr(struct super_block *sb, struct dentry *old,  in ovl_copy_xattr()
48 struct dentry *new) in ovl_copy_xattr()
159 err = ovl_set_protattr(inode, new->dentry, &oldfa); in ovl_copy_fileattr()
285 static int ovl_set_size(struct dentry *upperdentry, struct kstat *stat) in ovl_set_size()
295 static int ovl_set_timestamps(struct dentry *upperdentry, struct kstat *stat) in ovl_set_timestamps()
307 int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat) in ovl_set_attr()
332 struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct dentry *real, in ovl_encode_real_fh()
387 int ovl_set_origin(struct ovl_fs *ofs, struct dentry *lower, in ovl_set_origin()
388 struct dentry *upper) in ovl_set_origin()
416 static int ovl_set_upper_fh(struct ovl_fs *ofs, struct dentry *upper, in ovl_set_upper_fh()
417 struct dentry *index) in ovl_set_upper_fh()
437 static int ovl_create_index(struct dentry *dentry, struct dentry *origin, in ovl_create_index() argument
438 struct dentry *upper) in ovl_create_index()
440 struct ovl_fs *ofs = OVL_FS(dentry->d_sb); in ovl_create_index()
441 struct dentry *indexdir = ovl_indexdir(dentry->d_sb); in ovl_create_index()
443 struct dentry *index = NULL; in ovl_create_index()
444 struct dentry *temp = NULL; in ovl_create_index()
456 if (WARN_ON(!d_is_dir(dentry))) in ovl_create_index()
460 if (WARN_ON(ovl_test_flag(OVL_INDEX, d_inode(dentry)))) in ovl_create_index()
493 struct dentry *parent;
494 struct dentry *dentry; member
499 struct dentry *destdir;
501 struct dentry *workdir;
510 struct dentry *upper; in ovl_link_up()
511 struct dentry *upperdir = ovl_dentry_upper(c->parent); in ovl_link_up()
519 err = ovl_set_nlink_lower(c->dentry); in ovl_link_up()
524 upper = lookup_one_len(c->dentry->d_name.name, upperdir, in ovl_link_up()
525 c->dentry->d_name.len); in ovl_link_up()
528 err = ovl_do_link(ovl_dentry_upper(c->dentry), udir, upper); in ovl_link_up()
534 ovl_dentry_set_upper_alias(c->dentry); in ovl_link_up()
541 err = ovl_set_nlink_upper(c->dentry); in ovl_link_up()
546 static int ovl_copy_up_inode(struct ovl_copy_up_ctx *c, struct dentry *temp) in ovl_copy_up_inode()
548 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_copy_up_inode()
549 struct inode *inode = d_inode(c->dentry); in ovl_copy_up_inode()
553 ovl_path_upper(c->dentry, &upperpath); in ovl_copy_up_inode()
554 if (WARN_ON(upperpath.dentry != NULL)) in ovl_copy_up_inode()
557 upperpath.dentry = temp; in ovl_copy_up_inode()
564 ovl_path_lowerdata(c->dentry, &datapath); in ovl_copy_up_inode()
571 err = ovl_copy_xattr(c->dentry->d_sb, c->lowerpath.dentry, temp); in ovl_copy_up_inode()
593 err = ovl_set_origin(ofs, c->lowerpath.dentry, temp); in ovl_copy_up_inode()
620 static int ovl_prep_cu_creds(struct dentry *dentry, struct ovl_cu_creds *cc) in ovl_prep_cu_creds() argument
625 err = security_inode_copy_up(dentry, &cc->new); in ovl_prep_cu_creds()
651 struct dentry *temp, *upper; in ovl_copy_up_workdir()
666 err = ovl_prep_cu_creds(c->dentry, &cc); in ovl_copy_up_workdir()
682 err = ovl_create_index(c->dentry, c->lowerpath.dentry, temp); in ovl_copy_up_workdir()
698 ovl_set_upperdata(d_inode(c->dentry)); in ovl_copy_up_workdir()
699 inode = d_inode(c->dentry); in ovl_copy_up_workdir()
718 struct dentry *temp, *upper; in ovl_copy_up_tmpfile()
722 err = ovl_prep_cu_creds(c->dentry, &cc); in ovl_copy_up_tmpfile()
750 ovl_set_upperdata(d_inode(c->dentry)); in ovl_copy_up_tmpfile()
751 ovl_inode_update(d_inode(c->dentry), temp); in ovl_copy_up_tmpfile()
772 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_do_copy_up()
781 if (ovl_need_index(c->dentry)) { in ovl_do_copy_up()
784 c->workdir = ovl_indexdir(c->dentry->d_sb); in ovl_do_copy_up()
793 c->destdir = ovl_indexdir(c->dentry->d_sb); in ovl_do_copy_up()
794 err = ovl_get_index_name(ofs, c->lowerpath.dentry, &c->destname); in ovl_do_copy_up()
819 ovl_set_flag(OVL_INDEX, d_inode(c->dentry)); in ovl_do_copy_up()
823 err = ovl_set_nlink_upper(c->dentry); in ovl_do_copy_up()
832 ovl_dentry_set_upper_alias(c->dentry); in ovl_do_copy_up()
841 static bool ovl_need_meta_copy_up(struct dentry *dentry, umode_t mode, in ovl_need_meta_copy_up() argument
844 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; in ovl_need_meta_copy_up()
858 static ssize_t ovl_getxattr(struct dentry *dentry, char *name, char **value) in ovl_getxattr() argument
863 res = vfs_getxattr(&init_user_ns, dentry, name, NULL, 0); in ovl_getxattr()
872 res = vfs_getxattr(&init_user_ns, dentry, name, buf, res); in ovl_getxattr()
884 struct ovl_fs *ofs = OVL_FS(c->dentry->d_sb); in ovl_copy_up_meta_inode_data()
890 ovl_path_upper(c->dentry, &upperpath); in ovl_copy_up_meta_inode_data()
891 if (WARN_ON(upperpath.dentry == NULL)) in ovl_copy_up_meta_inode_data()
894 ovl_path_lowerdata(c->dentry, &datapath); in ovl_copy_up_meta_inode_data()
895 if (WARN_ON(datapath.dentry == NULL)) in ovl_copy_up_meta_inode_data()
899 err = cap_size = ovl_getxattr(upperpath.dentry, XATTR_NAME_CAPS, in ovl_copy_up_meta_inode_data()
914 err = vfs_setxattr(&init_user_ns, upperpath.dentry, in ovl_copy_up_meta_inode_data()
921 err = ovl_do_removexattr(ofs, upperpath.dentry, OVL_XATTR_METACOPY); in ovl_copy_up_meta_inode_data()
925 ovl_set_upperdata(d_inode(c->dentry)); in ovl_copy_up_meta_inode_data()
932 static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, in ovl_copy_up_one() argument
940 .dentry = dentry, in ovl_copy_up_one()
941 .workdir = ovl_workdir(dentry), in ovl_copy_up_one()
947 ovl_path_lower(dentry, &ctx.lowerpath); in ovl_copy_up_one()
953 ctx.metacopy = ovl_need_meta_copy_up(dentry, ctx.stat.mode, flags); in ovl_copy_up_one()
957 ctx.destdir = parentpath.dentry; in ovl_copy_up_one()
958 ctx.destname = dentry->d_name; in ovl_copy_up_one()
972 ctx.link = vfs_get_link(ctx.lowerpath.dentry, &done); in ovl_copy_up_one()
977 err = ovl_copy_up_start(dentry, flags); in ovl_copy_up_one()
983 if (!ovl_dentry_upper(dentry)) in ovl_copy_up_one()
985 if (!err && parent && !ovl_dentry_has_upper_alias(dentry)) in ovl_copy_up_one()
987 if (!err && ovl_dentry_needs_data_copy_up_locked(dentry, flags)) in ovl_copy_up_one()
989 ovl_copy_up_end(dentry); in ovl_copy_up_one()
996 static int ovl_copy_up_flags(struct dentry *dentry, int flags) in ovl_copy_up_flags() argument
1000 bool disconnected = (dentry->d_flags & DCACHE_DISCONNECTED); in ovl_copy_up_flags()
1007 if (WARN_ON(disconnected && d_is_dir(dentry))) in ovl_copy_up_flags()
1010 old_cred = ovl_override_creds(dentry->d_sb); in ovl_copy_up_flags()
1012 struct dentry *next; in ovl_copy_up_flags()
1013 struct dentry *parent = NULL; in ovl_copy_up_flags()
1015 if (ovl_already_copied_up(dentry, flags)) in ovl_copy_up_flags()
1018 next = dget(dentry); in ovl_copy_up_flags()
1040 static bool ovl_open_need_copy_up(struct dentry *dentry, int flags) in ovl_open_need_copy_up() argument
1043 if (ovl_already_copied_up(dentry, flags)) in ovl_open_need_copy_up()
1046 if (special_file(d_inode(dentry)->i_mode)) in ovl_open_need_copy_up()
1055 int ovl_maybe_copy_up(struct dentry *dentry, int flags) in ovl_maybe_copy_up() argument
1059 if (ovl_open_need_copy_up(dentry, flags)) { in ovl_maybe_copy_up()
1060 err = ovl_want_write(dentry); in ovl_maybe_copy_up()
1062 err = ovl_copy_up_flags(dentry, flags); in ovl_maybe_copy_up()
1063 ovl_drop_write(dentry); in ovl_maybe_copy_up()
1070 int ovl_copy_up_with_data(struct dentry *dentry) in ovl_copy_up_with_data() argument
1072 return ovl_copy_up_flags(dentry, O_WRONLY); in ovl_copy_up_with_data()
1075 int ovl_copy_up(struct dentry *dentry) in ovl_copy_up() argument
1077 return ovl_copy_up_flags(dentry, 0); in ovl_copy_up()