]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
client: Gracefully handle empty pathname for chownat()
authorAnoop C S <anoopcs@cryptolab.net>
Fri, 20 Sep 2024 08:49:01 +0000 (14:19 +0530)
committerAnoop C S <anoopcs@cryptolab.net>
Tue, 23 Sep 2025 13:50:59 +0000 (19:20 +0530)
commit098403c50dffc98d6b52ff6e8a7f2576944b449d
treee8b20198a6ca69c009631605efb75c46641531e8
parentf0ce7d30e591250e752b86d76544994564e71b60
client: Gracefully handle empty pathname for chownat()

man fchownat(2)[1] says the following:
. . .
AT_EMPTY_PATH (since Linux 2.6.39)
    If pathname is an empty string, operate on the file referred to by
    dirfd (which may have been obtained using the open(2) O_PATH flag).
    In this case, dirfd can refer to any type of file, not just a
    directory. If dirfd is AT_FDCWD, the call operates on the current
    working directory.
. . .

Look out for an empty pathname and use the relative fd's inode in the
presence of AT_EMPTY_PATH flag before calling internal _setattr().

Fixes: https://tracker.ceph.com/issues/68189
Review with: git show -w

[1] https://www.man7.org/linux/man-pages/man2/fchownat.2.html

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
(cherry picked from commit 829f38899226fcd1f603ba446b018f53c5b0921d)

Conflicts:
        src/client/Client.cc
- path_walk() refactor from https://github.com/ceph/ceph/pull/62095
  included the required core changes.
src/include/cephfs/libcephfs.h
src/test/libcephfs/test.cc