Lines Matching refs:dentry
19 static int ovl_encode_maybe_copy_up(struct dentry *dentry) in ovl_encode_maybe_copy_up() argument
23 if (ovl_dentry_upper(dentry)) in ovl_encode_maybe_copy_up()
26 err = ovl_want_write(dentry); in ovl_encode_maybe_copy_up()
28 err = ovl_copy_up(dentry); in ovl_encode_maybe_copy_up()
29 ovl_drop_write(dentry); in ovl_encode_maybe_copy_up()
34 dentry, err); in ovl_encode_maybe_copy_up()
77 static int ovl_connectable_layer(struct dentry *dentry) in ovl_connectable_layer() argument
79 struct ovl_entry *oe = OVL_E(dentry); in ovl_connectable_layer()
82 if (dentry == dentry->d_sb->s_root) in ovl_connectable_layer()
89 if (ovl_dentry_upper(dentry) && in ovl_connectable_layer()
90 !ovl_test_flag(OVL_INDEX, d_inode(dentry))) in ovl_connectable_layer()
105 static int ovl_connect_layer(struct dentry *dentry) in ovl_connect_layer() argument
107 struct dentry *next, *parent = NULL; in ovl_connect_layer()
111 if (WARN_ON(dentry == dentry->d_sb->s_root) || in ovl_connect_layer()
112 WARN_ON(!ovl_dentry_lower(dentry))) in ovl_connect_layer()
115 origin_layer = OVL_E(dentry)->lowerstack[0].layer->idx; in ovl_connect_layer()
116 if (ovl_dentry_test_flag(OVL_E_CONNECTED, dentry)) in ovl_connect_layer()
120 next = dget(dentry); in ovl_connect_layer()
150 ovl_dentry_set_flag(OVL_E_CONNECTED, dentry); in ovl_connect_layer()
183 static int ovl_check_encode_origin(struct dentry *dentry) in ovl_check_encode_origin() argument
185 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; in ovl_check_encode_origin()
188 if (!ovl_dentry_lower(dentry)) in ovl_check_encode_origin()
197 if (ovl_dentry_upper(dentry) && in ovl_check_encode_origin()
198 !ovl_test_flag(OVL_INDEX, d_inode(dentry))) in ovl_check_encode_origin()
207 if (d_is_dir(dentry) && ovl_upper_mnt(ofs)) in ovl_check_encode_origin()
208 return ovl_connect_layer(dentry); in ovl_check_encode_origin()
214 static int ovl_dentry_to_fid(struct ovl_fs *ofs, struct dentry *dentry, in ovl_dentry_to_fid() argument
225 err = enc_lower = ovl_check_encode_origin(dentry); in ovl_dentry_to_fid()
230 fh = ovl_encode_real_fh(ofs, enc_lower ? ovl_dentry_lower(dentry) : in ovl_dentry_to_fid()
231 ovl_dentry_upper(dentry), !enc_lower); in ovl_dentry_to_fid()
246 dentry, err); in ovl_dentry_to_fid()
254 struct dentry *dentry; in ovl_encode_fh() local
261 dentry = d_find_any_alias(inode); in ovl_encode_fh()
262 if (!dentry) in ovl_encode_fh()
265 bytes = ovl_dentry_to_fid(ofs, dentry, fid, buflen); in ovl_encode_fh()
266 dput(dentry); in ovl_encode_fh()
280 static struct dentry *ovl_obtain_alias(struct super_block *sb, in ovl_obtain_alias()
281 struct dentry *upper_alias, in ovl_obtain_alias()
283 struct dentry *index) in ovl_obtain_alias()
285 struct dentry *lower = lowerpath ? lowerpath->dentry : NULL; in ovl_obtain_alias()
286 struct dentry *upper = upper_alias ?: index; in ovl_obtain_alias()
287 struct dentry *dentry; in ovl_obtain_alias() local
310 dentry = d_find_any_alias(inode); in ovl_obtain_alias()
311 if (dentry) in ovl_obtain_alias()
314 dentry = d_alloc_anon(inode->i_sb); in ovl_obtain_alias()
315 if (unlikely(!dentry)) in ovl_obtain_alias()
322 oe->lowerstack->dentry = dget(lower); in ovl_obtain_alias()
325 dentry->d_fsdata = oe; in ovl_obtain_alias()
327 ovl_dentry_set_upper_alias(dentry); in ovl_obtain_alias()
329 ovl_dentry_init_reval(dentry, upper); in ovl_obtain_alias()
331 return d_instantiate_anon(dentry, inode); in ovl_obtain_alias()
334 dput(dentry); in ovl_obtain_alias()
335 dentry = ERR_PTR(-ENOMEM); in ovl_obtain_alias()
338 return dentry; in ovl_obtain_alias()
342 static struct dentry *ovl_dentry_real_at(struct dentry *dentry, int idx) in ovl_dentry_real_at() argument
344 struct ovl_entry *oe = dentry->d_fsdata; in ovl_dentry_real_at()
348 return ovl_dentry_upper(dentry); in ovl_dentry_real_at()
352 return oe->lowerstack[i].dentry; in ovl_dentry_real_at()
364 static struct dentry *ovl_lookup_real_one(struct dentry *connected, in ovl_lookup_real_one()
365 struct dentry *real, in ovl_lookup_real_one()
369 struct dentry *this, *parent = NULL; in ovl_lookup_real_one()
420 static struct dentry *ovl_lookup_real(struct super_block *sb,
421 struct dentry *real,
427 static struct dentry *ovl_lookup_real_inode(struct super_block *sb, in ovl_lookup_real_inode()
428 struct dentry *real, in ovl_lookup_real_inode()
432 struct dentry *index = NULL; in ovl_lookup_real_inode()
433 struct dentry *this = NULL; in ovl_lookup_real_inode()
460 struct dentry *upper = ovl_index_upper(ofs, index); in ovl_lookup_real_inode()
492 static struct dentry *ovl_lookup_real_ancestor(struct super_block *sb, in ovl_lookup_real_ancestor()
493 struct dentry *real, in ovl_lookup_real_ancestor()
496 struct dentry *next, *parent = NULL; in ovl_lookup_real_ancestor()
497 struct dentry *ancestor = ERR_PTR(-EIO); in ovl_lookup_real_ancestor()
545 static struct dentry *ovl_lookup_real(struct super_block *sb, in ovl_lookup_real()
546 struct dentry *real, in ovl_lookup_real()
549 struct dentry *connected; in ovl_lookup_real()
557 struct dentry *next, *this; in ovl_lookup_real()
558 struct dentry *parent = NULL; in ovl_lookup_real()
559 struct dentry *real_connected = ovl_dentry_real_at(connected, in ovl_lookup_real()
647 static struct dentry *ovl_get_dentry(struct super_block *sb, in ovl_get_dentry()
648 struct dentry *upper, in ovl_get_dentry()
650 struct dentry *index) in ovl_get_dentry()
654 struct dentry *real = upper ?: (index ?: lowerpath->dentry); in ovl_get_dentry()
674 static struct dentry *ovl_upper_fh_to_d(struct super_block *sb, in ovl_upper_fh_to_d()
678 struct dentry *dentry; in ovl_upper_fh_to_d() local
679 struct dentry *upper; in ovl_upper_fh_to_d()
688 dentry = ovl_get_dentry(sb, upper, NULL, NULL); in ovl_upper_fh_to_d()
691 return dentry; in ovl_upper_fh_to_d()
694 static struct dentry *ovl_lower_fh_to_d(struct super_block *sb, in ovl_lower_fh_to_d()
700 struct dentry *dentry = NULL; in ovl_lower_fh_to_d() local
701 struct dentry *index = NULL; in ovl_lower_fh_to_d()
710 if (!d_is_dir(origin.dentry) || in ovl_lower_fh_to_d()
711 !(origin.dentry->d_flags & DCACHE_DISCONNECTED)) { in ovl_lower_fh_to_d()
712 inode = ovl_lookup_inode(sb, origin.dentry, false); in ovl_lower_fh_to_d()
717 dentry = d_find_any_alias(inode); in ovl_lower_fh_to_d()
719 if (dentry) in ovl_lower_fh_to_d()
736 struct dentry *upper = ovl_index_upper(ofs, index); in ovl_lower_fh_to_d()
742 dentry = ovl_get_dentry(sb, upper, NULL, NULL); in ovl_lower_fh_to_d()
748 if (d_is_dir(origin.dentry)) { in ovl_lower_fh_to_d()
749 dput(origin.dentry); in ovl_lower_fh_to_d()
750 origin.dentry = NULL; in ovl_lower_fh_to_d()
756 err = ovl_verify_origin(ofs, index, origin.dentry, false); in ovl_lower_fh_to_d()
762 dentry = ovl_get_dentry(sb, NULL, &origin, index); in ovl_lower_fh_to_d()
765 dput(origin.dentry); in ovl_lower_fh_to_d()
767 return dentry; in ovl_lower_fh_to_d()
770 dentry = ERR_PTR(err); in ovl_lower_fh_to_d()
797 static struct dentry *ovl_fh_to_dentry(struct super_block *sb, struct fid *fid, in ovl_fh_to_dentry()
800 struct dentry *dentry = NULL; in ovl_fh_to_dentry() local
816 dentry = (flags & OVL_FH_FLAG_PATH_UPPER) ? in ovl_fh_to_dentry()
819 err = PTR_ERR(dentry); in ovl_fh_to_dentry()
820 if (IS_ERR(dentry) && err != -ESTALE) in ovl_fh_to_dentry()
828 return dentry; in ovl_fh_to_dentry()
833 dentry = ERR_PTR(err); in ovl_fh_to_dentry()
837 static struct dentry *ovl_fh_to_parent(struct super_block *sb, struct fid *fid, in ovl_fh_to_parent()
844 static int ovl_get_name(struct dentry *parent, char *name, in ovl_get_name()
845 struct dentry *child) in ovl_get_name()
855 static struct dentry *ovl_get_parent(struct dentry *dentry) in ovl_get_parent() argument