• Home
  • Raw
  • Download

Lines Matching refs:dentry

33 static int __dir_lease_try_check(const struct dentry *dentry);
38 static int ceph_d_init(struct dentry *dentry) in ceph_d_init() argument
41 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dentry->d_sb); in ceph_d_init()
47 di->dentry = dentry; in ceph_d_init()
50 dentry->d_fsdata = di; in ceph_d_init()
127 static struct dentry *
128 __dcache_find_get_entry(struct dentry *parent, u64 idx, in __dcache_find_get_entry()
132 struct dentry *dentry; in __dcache_find_get_entry() local
133 unsigned idx_mask = (PAGE_SIZE / sizeof(struct dentry *)) - 1; in __dcache_find_get_entry()
134 loff_t ptr_pos = idx * sizeof(struct dentry *); in __dcache_find_get_entry()
160 dentry = cache_ctl->dentries[cache_ctl->index]; in __dcache_find_get_entry()
162 dentry = NULL; in __dcache_find_get_entry()
164 if (dentry && !lockref_get_not_dead(&dentry->d_lockref)) in __dcache_find_get_entry()
165 dentry = NULL; in __dcache_find_get_entry()
167 return dentry ? : ERR_PTR(-EAGAIN); in __dcache_find_get_entry()
185 struct dentry *parent = file->f_path.dentry; in __dcache_readdir()
187 struct dentry *dentry, *last = NULL; in __dcache_readdir() local
197 u64 count = div_u64(i_size_read(dir), sizeof(struct dentry *)); in __dcache_readdir()
200 dentry = __dcache_find_get_entry(parent, idx + step, in __dcache_readdir()
202 if (!dentry) { in __dcache_readdir()
207 if (IS_ERR(dentry)) { in __dcache_readdir()
208 err = PTR_ERR(dentry); in __dcache_readdir()
211 di = ceph_dentry(dentry); in __dcache_readdir()
212 spin_lock(&dentry->d_lock); in __dcache_readdir()
219 spin_unlock(&dentry->d_lock); in __dcache_readdir()
220 dput(dentry); in __dcache_readdir()
229 dentry = __dcache_find_get_entry(parent, idx++, &cache_ctl); in __dcache_readdir()
230 if (!dentry) { in __dcache_readdir()
235 if (IS_ERR(dentry)) { in __dcache_readdir()
236 err = PTR_ERR(dentry); in __dcache_readdir()
240 spin_lock(&dentry->d_lock); in __dcache_readdir()
241 di = ceph_dentry(dentry); in __dcache_readdir()
242 if (d_unhashed(dentry) || in __dcache_readdir()
243 d_really_is_negative(dentry) || in __dcache_readdir()
245 spin_unlock(&dentry->d_lock); in __dcache_readdir()
246 dput(dentry); in __dcache_readdir()
254 spin_unlock(&dentry->d_lock); in __dcache_readdir()
258 dentry, dentry, d_inode(dentry)); in __dcache_readdir()
260 if (!dir_emit(ctx, dentry->d_name.name, in __dcache_readdir()
261 dentry->d_name.len, ceph_present_inode(d_inode(dentry)), in __dcache_readdir()
262 d_inode(dentry)->i_mode >> 12)) { in __dcache_readdir()
263 dput(dentry); in __dcache_readdir()
271 last = dentry; in __dcache_readdir()
273 dput(dentry); in __dcache_readdir()
331 struct dentry *dentry = file->f_path.dentry; in ceph_readdir() local
333 spin_lock(&dentry->d_lock); in ceph_readdir()
334 ino = ceph_present_inode(dentry->d_parent->d_inode); in ceph_readdir()
335 spin_unlock(&dentry->d_lock); in ceph_readdir()
425 req->r_dentry = dget(file->f_path.dentry); in ceph_readdir()
581 sizeof(struct dentry*)); in ceph_readdir()
678 struct dentry *dentry, int err) in ceph_handle_snapdir() argument
680 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); in ceph_handle_snapdir()
681 struct inode *parent = d_inode(dentry->d_parent); /* we hold i_mutex */ in ceph_handle_snapdir()
686 strcmp(dentry->d_name.name, in ceph_handle_snapdir()
690 dentry, dentry, inode); in ceph_handle_snapdir()
691 BUG_ON(!d_unhashed(dentry)); in ceph_handle_snapdir()
692 d_add(dentry, inode); in ceph_handle_snapdir()
709 struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, in ceph_finish_lookup()
710 struct dentry *dentry, int err) in ceph_finish_lookup() argument
717 dentry, d_inode(dentry)); in ceph_finish_lookup()
718 if (d_really_is_positive(dentry)) { in ceph_finish_lookup()
719 d_drop(dentry); in ceph_finish_lookup()
722 d_add(dentry, NULL); in ceph_finish_lookup()
727 dentry = ERR_PTR(err); in ceph_finish_lookup()
728 else if (dentry != req->r_dentry) in ceph_finish_lookup()
729 dentry = dget(req->r_dentry); /* we got spliced */ in ceph_finish_lookup()
731 dentry = NULL; in ceph_finish_lookup()
732 return dentry; in ceph_finish_lookup()
735 static bool is_root_ceph_dentry(struct inode *inode, struct dentry *dentry) in is_root_ceph_dentry() argument
738 strncmp(dentry->d_name.name, ".ceph", 5) == 0; in is_root_ceph_dentry()
745 static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, in ceph_lookup() argument
756 dir, dentry, dentry); in ceph_lookup()
758 if (dentry->d_name.len > NAME_MAX) in ceph_lookup()
762 if (d_really_is_negative(dentry)) { in ceph_lookup()
764 struct ceph_dentry_info *di = ceph_dentry(dentry); in ceph_lookup()
768 if (strncmp(dentry->d_name.name, in ceph_lookup()
770 dentry->d_name.len) && in ceph_lookup()
771 !is_root_ceph_dentry(dir, dentry) && in ceph_lookup()
778 d_add(dentry, NULL); in ceph_lookup()
790 req->r_dentry = dget(dentry); in ceph_lookup()
801 err = ceph_handle_snapdir(req, dentry, err); in ceph_lookup()
802 dentry = ceph_finish_lookup(req, dentry, err); in ceph_lookup()
804 dout("lookup result=%p\n", dentry); in ceph_lookup()
805 return dentry; in ceph_lookup()
812 int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry) in ceph_handle_notrace_create() argument
814 struct dentry *result = ceph_lookup(dir, dentry, 0); in ceph_handle_notrace_create()
835 static int ceph_mknod(struct inode *dir, struct dentry *dentry, in ceph_mknod() argument
854 err = ceph_security_init_secctx(dentry, mode, &as_ctx); in ceph_mknod()
859 dir, dentry, mode, rdev); in ceph_mknod()
865 req->r_dentry = dget(dentry); in ceph_mknod()
879 err = ceph_handle_notrace_create(dir, dentry); in ceph_mknod()
883 ceph_init_inode_acls(d_inode(dentry), &as_ctx); in ceph_mknod()
885 d_drop(dentry); in ceph_mknod()
890 static int ceph_create(struct inode *dir, struct dentry *dentry, umode_t mode, in ceph_create() argument
893 return ceph_mknod(dir, dentry, mode, 0); in ceph_create()
896 static int ceph_symlink(struct inode *dir, struct dentry *dentry, in ceph_symlink() argument
912 err = ceph_security_init_secctx(dentry, S_IFLNK | 0777, &as_ctx); in ceph_symlink()
916 dout("symlink in dir %p dentry %p to '%s'\n", dir, dentry, dest); in ceph_symlink()
930 req->r_dentry = dget(dentry); in ceph_symlink()
940 err = ceph_handle_notrace_create(dir, dentry); in ceph_symlink()
944 d_drop(dentry); in ceph_symlink()
949 static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) in ceph_mkdir() argument
961 dentry, dentry); in ceph_mkdir()
963 dout("mkdir dir %p dn %p mode 0%ho\n", dir, dentry, mode); in ceph_mkdir()
979 err = ceph_security_init_secctx(dentry, mode, &as_ctx); in ceph_mkdir()
989 req->r_dentry = dget(dentry); in ceph_mkdir()
1004 err = ceph_handle_notrace_create(dir, dentry); in ceph_mkdir()
1008 ceph_init_inode_acls(d_inode(dentry), &as_ctx); in ceph_mkdir()
1010 d_drop(dentry); in ceph_mkdir()
1015 static int ceph_link(struct dentry *old_dentry, struct inode *dir, in ceph_link()
1016 struct dentry *dentry) in ceph_link() argument
1026 old_dentry, dentry); in ceph_link()
1029 d_drop(dentry); in ceph_link()
1032 req->r_dentry = dget(dentry); in ceph_link()
1043 d_drop(dentry); in ceph_link()
1046 d_instantiate(dentry, d_inode(old_dentry)); in ceph_link()
1088 static int get_caps_for_async_unlink(struct inode *dir, struct dentry *dentry) in get_caps_for_async_unlink() argument
1105 spin_lock(&dentry->d_lock); in get_caps_for_async_unlink()
1106 di = ceph_dentry(dentry); in get_caps_for_async_unlink()
1114 spin_unlock(&dentry->d_lock); in get_caps_for_async_unlink()
1127 static int ceph_unlink(struct inode *dir, struct dentry *dentry) in ceph_unlink() argument
1131 struct inode *inode = d_inode(dentry); in ceph_unlink()
1139 dout("rmsnap dir %p '%pd' dn %p\n", dir, dentry, dentry); in ceph_unlink()
1143 dir, dentry, inode); in ceph_unlink()
1144 op = d_is_dir(dentry) ? in ceph_unlink()
1154 req->r_dentry = dget(dentry); in ceph_unlink()
1162 (req->r_dir_caps = get_caps_for_async_unlink(dir, dentry))) { in ceph_unlink()
1164 dentry->d_name.len, dentry->d_name.name, in ceph_unlink()
1168 req->r_old_inode = d_inode(dentry); in ceph_unlink()
1177 d_delete(dentry); in ceph_unlink()
1187 d_delete(dentry); in ceph_unlink()
1195 static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, in ceph_rename()
1196 struct inode *new_dir, struct dentry *new_dentry, in ceph_rename()
1265 struct dentry *dn = di->dentry; in __ceph_dentry_lease_touch()
1299 struct dentry *dn = di->dentry; in __ceph_dentry_dir_lease_touch()
1337 mdsc = ceph_sb_to_client(di->dentry->d_sb)->mdsc; in __dentry_lease_unlist()
1360 int (*check)(struct dentry*, void*)) in __dentry_leases_walk() argument
1363 struct dentry *dentry, *last = NULL; in __dentry_leases_walk() local
1376 dentry = di->dentry; in __dentry_leases_walk()
1377 if (last == dentry) in __dentry_leases_walk()
1380 if (!spin_trylock(&dentry->d_lock)) in __dentry_leases_walk()
1383 if (__lockref_is_dead(&dentry->d_lockref)) { in __dentry_leases_walk()
1388 ret = check(dentry, lwc); in __dentry_leases_walk()
1393 last = dentry; in __dentry_leases_walk()
1398 if (dentry->d_lockref.count > 0) { in __dentry_leases_walk()
1407 dget_dlock(dentry); in __dentry_leases_walk()
1411 spin_unlock(&dentry->d_lock); in __dentry_leases_walk()
1420 dentry = di->dentry; in __dentry_leases_walk()
1421 spin_lock(&dentry->d_lock); in __dentry_leases_walk()
1438 spin_unlock(&dentry->d_lock); in __dentry_leases_walk()
1440 dput(dentry); in __dentry_leases_walk()
1445 static int __dentry_lease_check(struct dentry *dentry, void *arg) in __dentry_lease_check() argument
1447 struct ceph_dentry_info *di = ceph_dentry(dentry); in __dentry_lease_check()
1452 ret = __dir_lease_try_check(dentry); in __dentry_lease_check()
1460 static int __dir_lease_check(struct dentry *dentry, void *arg) in __dir_lease_check() argument
1463 struct ceph_dentry_info *di = ceph_dentry(dentry); in __dir_lease_check()
1465 int ret = __dir_lease_try_check(dentry); in __dir_lease_check()
1476 if (dentry->d_lockref.count > 0 || in __dir_lease_check()
1521 void ceph_invalidate_dentry_lease(struct dentry *dentry) in ceph_invalidate_dentry_lease() argument
1523 struct ceph_dentry_info *di = ceph_dentry(dentry); in ceph_invalidate_dentry_lease()
1524 spin_lock(&dentry->d_lock); in ceph_invalidate_dentry_lease()
1529 spin_unlock(&dentry->d_lock); in ceph_invalidate_dentry_lease()
1562 static int dentry_lease_is_valid(struct dentry *dentry, unsigned int flags) in dentry_lease_is_valid() argument
1569 spin_lock(&dentry->d_lock); in dentry_lease_is_valid()
1570 di = ceph_dentry(dentry); in dentry_lease_is_valid()
1591 spin_unlock(&dentry->d_lock); in dentry_lease_is_valid()
1594 ceph_mdsc_lease_send_msg(session, dentry, in dentry_lease_is_valid()
1598 dout("dentry_lease_is_valid - dentry %p = %d\n", dentry, valid); in dentry_lease_is_valid()
1605 static int __dir_lease_try_check(const struct dentry *dentry) in __dir_lease_try_check() argument
1607 struct ceph_dentry_info *di = ceph_dentry(dentry); in __dir_lease_try_check()
1614 if (IS_ROOT(dentry)) in __dir_lease_try_check()
1617 dir = d_inode(dentry->d_parent); in __dir_lease_try_check()
1637 static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry, in dir_lease_is_valid() argument
1653 spin_lock(&dentry->d_lock); in dir_lease_is_valid()
1654 di = ceph_dentry(dentry); in dir_lease_is_valid()
1655 if (dir == d_inode(dentry->d_parent) && in dir_lease_is_valid()
1660 spin_unlock(&dentry->d_lock); in dir_lease_is_valid()
1663 dir, (unsigned)atomic_read(&ci->i_shared_gen), dentry, valid); in dir_lease_is_valid()
1670 static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) in ceph_d_revalidate() argument
1673 struct dentry *parent; in ceph_d_revalidate()
1678 parent = READ_ONCE(dentry->d_parent); in ceph_d_revalidate()
1682 inode = d_inode_rcu(dentry); in ceph_d_revalidate()
1684 parent = dget_parent(dentry); in ceph_d_revalidate()
1686 inode = d_inode(dentry); in ceph_d_revalidate()
1689 dout("d_revalidate %p '%pd' inode %p offset 0x%llx\n", dentry, in ceph_d_revalidate()
1690 dentry, inode, ceph_dentry(dentry)->offset); in ceph_d_revalidate()
1696 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, in ceph_d_revalidate()
1697 dentry, inode); in ceph_d_revalidate()
1702 valid = dentry_lease_is_valid(dentry, flags); in ceph_d_revalidate()
1705 if (valid || dir_lease_is_valid(dir, dentry, mdsc)) { in ceph_d_revalidate()
1727 req->r_dentry = dget(dentry); in ceph_d_revalidate()
1739 if (d_really_is_positive(dentry) && in ceph_d_revalidate()
1740 d_inode(dentry) == req->r_target_inode) in ceph_d_revalidate()
1744 if (d_really_is_negative(dentry)) in ceph_d_revalidate()
1752 dentry, err); in ceph_d_revalidate()
1758 dout("d_revalidate %p %s\n", dentry, valid ? "valid" : "invalid"); in ceph_d_revalidate()
1772 static int ceph_d_delete(const struct dentry *dentry) in ceph_d_delete() argument
1777 if (d_really_is_negative(dentry)) in ceph_d_delete()
1779 if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP) in ceph_d_delete()
1782 di = ceph_dentry(dentry); in ceph_d_delete()
1786 if (__dir_lease_try_check(dentry)) in ceph_d_delete()
1795 static void ceph_d_release(struct dentry *dentry) in ceph_d_release() argument
1797 struct ceph_dentry_info *di = ceph_dentry(dentry); in ceph_d_release()
1798 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); in ceph_d_release()
1800 dout("d_release %p\n", dentry); in ceph_d_release()
1804 spin_lock(&dentry->d_lock); in ceph_d_release()
1806 dentry->d_fsdata = NULL; in ceph_d_release()
1807 spin_unlock(&dentry->d_lock); in ceph_d_release()
1819 static void ceph_d_prune(struct dentry *dentry) in ceph_d_prune() argument
1824 dout("ceph_d_prune %pd %p\n", dentry, dentry); in ceph_d_prune()
1827 if (IS_ROOT(dentry)) in ceph_d_prune()
1831 dir_ci = ceph_inode(d_inode(dentry->d_parent)); in ceph_d_prune()
1836 if (d_really_is_negative(dentry)) in ceph_d_prune()
1840 if (!d_unhashed(dentry)) { in ceph_d_prune()
1848 di = ceph_dentry(dentry); in ceph_d_prune()
1911 unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn) in ceph_dentry_hash()