• Home
  • Raw
  • Download

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) { 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()
346 * export_encode_fh - default export_operations->encode_fh function
372 fid->i32.ino = inode->i_ino; in export_encode_fh()
373 fid->i32.gen = inode->i_generation; in export_encode_fh()
375 fid->i32.parent_ino = parent->i_ino; in export_encode_fh()
376 fid->i32.parent_gen = parent->i_generation; in export_encode_fh()
385 * exportfs_encode_inode_fh - encode a file handle from inode
397 const struct export_operations *nop = inode->i_sb->s_export_op; in exportfs_encode_inode_fh()
403 if (nop && !(flags & EXPORT_FH_FID) && !nop->fh_to_dentry) in exportfs_encode_inode_fh()
404 return -EOPNOTSUPP; in exportfs_encode_inode_fh()
406 if (nop && nop->encode_fh) in exportfs_encode_inode_fh()
407 return nop->encode_fh(inode, fid->raw, max_len, parent); in exportfs_encode_inode_fh()
414 * exportfs_encode_fh - encode a file handle from dentry
427 struct inode *inode = dentry->d_inode, *parent = NULL; in exportfs_encode_fh()
429 if ((flags & EXPORT_FH_CONNECTABLE) && !S_ISDIR(inode->i_mode)) { in exportfs_encode_fh()
433 * it's still pinned by and still positive. in exportfs_encode_fh()
435 parent = p->d_inode; in exportfs_encode_fh()
451 const struct export_operations *nop = mnt->mnt_sb->s_export_op; in exportfs_decode_fh_raw()
459 if (!nop || !nop->fh_to_dentry) in exportfs_decode_fh_raw()
460 return ERR_PTR(-ESTALE); in exportfs_decode_fh_raw()
461 result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); in exportfs_decode_fh_raw()
478 * On the positive side there is only one dentry for each in exportfs_decode_fh_raw()
480 * to ensure our dentry is connected all the way up to the in exportfs_decode_fh_raw()
483 if (result->d_flags & DCACHE_DISCONNECTED) { in exportfs_decode_fh_raw()
490 err = -EACCES; in exportfs_decode_fh_raw()
508 * it's connected to the filesystem root. in exportfs_decode_fh_raw()
518 err = -ESTALE; in exportfs_decode_fh_raw()
519 if (!nop->fh_to_parent) in exportfs_decode_fh_raw()
522 target_dir = nop->fh_to_parent(mnt->mnt_sb, fid, in exportfs_decode_fh_raw()
532 * connected to the filesystem root. The VFS really doesn't in exportfs_decode_fh_raw()
542 * Now that we've got both a well-connected parent and a in exportfs_decode_fh_raw()
544 * inode is actually connected to the parent. in exportfs_decode_fh_raw()
552 inode_lock(target_dir->d_inode); in exportfs_decode_fh_raw()
556 if (unlikely(nresult->d_inode != result->d_inode)) { in exportfs_decode_fh_raw()
558 nresult = ERR_PTR(-ESTALE); in exportfs_decode_fh_raw()
561 inode_unlock(target_dir->d_inode); in exportfs_decode_fh_raw()
581 err = -EACCES; in exportfs_decode_fh_raw()
604 if (ret == ERR_PTR(-ENOMEM)) in exportfs_decode_fh()
606 return ERR_PTR(-ESTALE); in exportfs_decode_fh()