Lines Matching +full:connected +full:- +full:positive

1 // SPDX-License-Identifier: GPL-2.0-only
30 const struct export_operations *nop = dir->d_sb->s_export_op; in exportfs_get_name()
33 if (nop->get_name) in exportfs_get_name()
34 return nop->get_name(dir, name, child); in exportfs_get_name()
53 inode = result->d_inode; in find_acceptable_alias()
54 spin_lock(&inode->i_lock); in find_acceptable_alias()
55 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { in find_acceptable_alias()
57 spin_unlock(&inode->i_lock); in find_acceptable_alias()
64 spin_lock(&inode->i_lock); in find_acceptable_alias()
67 spin_unlock(&inode->i_lock); in find_acceptable_alias()
77 while (dentry->d_flags & DCACHE_DISCONNECTED) { in dentry_connected()
94 while (dentry->d_flags & DCACHE_DISCONNECTED) { in clear_disconnected()
99 spin_lock(&dentry->d_lock); in clear_disconnected()
100 dentry->d_flags &= ~DCACHE_DISCONNECTED; in clear_disconnected()
101 spin_unlock(&dentry->d_lock); in clear_disconnected()
128 parent = ERR_PTR(-EACCES); in reconnect_one()
129 inode_lock(dentry->d_inode); in reconnect_one()
130 if (mnt->mnt_sb->s_export_op->get_parent) in reconnect_one()
131 parent = mnt->mnt_sb->s_export_op->get_parent(dentry); in reconnect_one()
132 inode_unlock(dentry->d_inode); in reconnect_one()
136 dentry->d_inode->i_ino, PTR_ERR(parent)); in reconnect_one()
141 dentry->d_inode->i_ino, parent->d_inode->i_ino); in reconnect_one()
143 if (err == -ENOENT) in reconnect_one()
158 * got looked up and thus connected, and it would in reconnect_one()
159 * remain connected afterwards. We are done. in reconnect_one()
166 err = -ESTALE; in reconnect_one()
187 * double check that this worked and return -ESTALE if not: in reconnect_one()
190 return ERR_PTR(-ESTALE); in reconnect_one()
195 * Make sure target_dir is fully connected to the dentry tree.
198 * target_dir, and target_dir->d_parent->...->d_parent will reach the
201 * Whenever DCACHE_DISCONNECTED is unset, target_dir is fully connected.
203 * set but already be connected. In that case we'll verify the
208 * connected, but further operations using the filehandle will fail when
218 while (dentry->d_flags & DCACHE_DISCONNECTED) { in reconnect_path()
219 BUG_ON(dentry == mnt->mnt_sb->s_root); in reconnect_path()
257 buf->sequence++; in filldir_one()
258 if (buf->ino == ino && len <= NAME_MAX && !is_dot_dotdot(name, len)) { in filldir_one()
259 memcpy(buf->name, name, len); in filldir_one()
260 buf->name[len] = '\0'; in filldir_one()
261 buf->found = 1; in filldir_one()
268 * get_name - default export_operations->get_name function
279 struct inode *dir = path->dentry->d_inode; in get_name()
284 .mnt = path->mnt, in get_name()
292 error = -ENOTDIR; in get_name()
293 if (!dir || !S_ISDIR(dir->i_mode)) in get_name()
295 error = -EINVAL; in get_name()
296 if (!dir->i_fop) in get_name()
299 * inode->i_ino is unsigned long, kstat->ino is u64, so the in get_name()
300 * former would be insufficient on 32-bit hosts when the in get_name()
301 * filesystem supports 64-bit inode numbers. So we need to in get_name()
302 * actually call ->getattr, not just read i_ino: in get_name()
317 error = -EINVAL; in get_name()
318 if (!file->f_op->iterate_shared) in get_name()
334 error = -ENOENT; in get_name()
348 * exportfs_encode_ino64_fid - encode non-decodeable 64bit ino file id
353 * This generic function is used to encode a non-decodeable file id for
364 fid->i64.ino = inode->i_ino; in exportfs_encode_ino64_fid()
365 fid->i64.gen = inode->i_generation; in exportfs_encode_ino64_fid()
372 * exportfs_encode_inode_fh - encode a file handle from inode
384 const struct export_operations *nop = inode->i_sb->s_export_op; in exportfs_encode_inode_fh()
388 return -EOPNOTSUPP; in exportfs_encode_inode_fh()
393 type = nop->encode_fh(inode, fid->raw, max_len, parent); in exportfs_encode_inode_fh()
397 __func__, type, inode->i_sb->s_type->name); in exportfs_encode_inode_fh()
398 return -EINVAL; in exportfs_encode_inode_fh()
407 * exportfs_encode_fh - encode a file handle from dentry
420 struct inode *inode = dentry->d_inode, *parent = NULL; in exportfs_encode_fh()
422 if ((flags & EXPORT_FH_CONNECTABLE) && !S_ISDIR(inode->i_mode)) { in exportfs_encode_fh()
426 * it's still pinned by and still positive. in exportfs_encode_fh()
428 parent = p->d_inode; in exportfs_encode_fh()
444 const struct export_operations *nop = mnt->mnt_sb->s_export_op; in exportfs_decode_fh_raw()
450 return ERR_PTR(-EINVAL); in exportfs_decode_fh_raw()
456 return ERR_PTR(-ESTALE); in exportfs_decode_fh_raw()
457 result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); in exportfs_decode_fh_raw()
462 err = -ENOTDIR; in exportfs_decode_fh_raw()
479 * On the positive side there is only one dentry for each in exportfs_decode_fh_raw()
481 * to ensure our dentry is connected all the way up to the in exportfs_decode_fh_raw()
484 if (result->d_flags & DCACHE_DISCONNECTED) { in exportfs_decode_fh_raw()
491 err = -EACCES; in exportfs_decode_fh_raw()
509 * it's connected to the filesystem root. in exportfs_decode_fh_raw()
519 err = -ESTALE; in exportfs_decode_fh_raw()
520 if (!nop->fh_to_parent) in exportfs_decode_fh_raw()
523 target_dir = nop->fh_to_parent(mnt->mnt_sb, fid, in exportfs_decode_fh_raw()
533 * connected to the filesystem root. The VFS really doesn't in exportfs_decode_fh_raw()
543 * Now that we've got both a well-connected parent and a in exportfs_decode_fh_raw()
545 * inode is actually connected to the parent. in exportfs_decode_fh_raw()
553 inode_lock(target_dir->d_inode); in exportfs_decode_fh_raw()
557 if (unlikely(nresult->d_inode != result->d_inode)) { in exportfs_decode_fh_raw()
559 nresult = ERR_PTR(-ESTALE); in exportfs_decode_fh_raw()
562 inode_unlock(target_dir->d_inode); in exportfs_decode_fh_raw()
582 err = -EACCES; in exportfs_decode_fh_raw()
605 if (ret == ERR_PTR(-ENOMEM)) in exportfs_decode_fh()
607 return ERR_PTR(-ESTALE); in exportfs_decode_fh()