]> git.apps.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>
Mon, 17 Mar 2025 19:43:19 +0000 (15:43 -0400)
commitde04ceb2c2ce78bcfebad479751fccdb8bb9db84
tree2055adc85c106333f041ed04a27f96846c4d7bef
parenta1e2621621a494f927f7474de443c7adc98adf65
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>
(cherry picked from commit b8662fdb03373ed6d29c47efa94cd391a7c9e740)

Conflicts:
src/client/Client.cc: minor code differences
src/client/Client.cc
src/client/Client.h