]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
client: refactor all path traversals through path_walk
authorPatrick Donnelly <pdonnell@ibm.com>
Thu, 14 Nov 2024 18:28:20 +0000 (13:28 -0500)
committerPatrick Donnelly <pdonnell@ibm.com>
Thu, 27 Feb 2025 18:41:56 +0000 (13:41 -0500)
commitb8662fdb03373ed6d29c47efa94cd391a7c9e740
treedbbaa2479667401222161d68f0f216777847f343
parentaaaa04264a02e6e89ca5721cad048c41ad3e1111
client: refactor all path traversals through path_walk

This is groundwork to ensure that all code paths properly apply dentry name
transformations during traversal, specifically for casefolding.

Note some ancillary changes:

* readlink now correctly does lookup permission checks during path walk (previously a TODO).

* There has been some tweaking of the method signatures to accept an `const
  InodeRef&`. This was convenient when passing walk_dentry_result::diri around
  but the cascade in changes prompted me to leave it partially done to avoid
  blowing up this changeset.

It's worth noting that this change is somewhat "half done". I had made an
effort to have all operations (whether fuse or libcephfs) call path_walk once.
This was done for Client::_mkdir and a few others. See for example:

  - do_mkdirat -> _mkdir
  - mksnap -> _mkdir
  - ll_mkdir -> _mkdir
  - mkdirs -> _mkdir (this had other significant simplification/cleanup);
    however: note that we still have two calls to path_walk for any given
    directory to be created. This is not a problem because:

Client::path_walk is now more tolerant of being called in a openat-style way.
The method now accepts an anchor directory and relative path (which may be a
single dentry name for ll_* calls). It is also tolerant of the directory inode
in fact referencing the target inode with relative path == "". That is a useful
property for many openat-style APIs (although largely unofficially).  It also
means that if we resolve a path then we can pass the resolved Inode (directory)
/ string (Dentry name) pair to another method which may also call path_walk
with minimal replication of path walk work. This is done a few times in this
changeset.

Fixes: https://tracker.ceph.com/issues/66373
Fixes: https://tracker.ceph.com/issues/70100
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/client/Client.cc
src/client/Client.h