Skip to content

Commit 1f0900c

Browse files
committed
Merge PR ceph#62406 into main
* refs/pull/62406/head: client: process path without inode anchor test/client: add ll_walk test with cwd and root path Reviewed-by: Dhairya Parmar <[email protected]>
2 parents 2b873b9 + 25eb99d commit 1f0900c

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

src/client/Client.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13453,18 +13453,15 @@ int Client::ll_walk(const char* name, Inode **out, struct ceph_statx *stx,
1345313453
if (!mref_reader.is_state_satisfied())
1345413454
return -ENOTCONN;
1345513455

13456-
filepath fp(name, 0);
1345713456
InodeRef in;
13458-
int rc;
1345913457
unsigned mask = statx_to_mask(flags, want);
1346013458

1346113459
ldout(cct, 3) << __func__ << " " << name << dendl;
1346213460
tout(cct) << __func__ << std::endl;
1346313461
tout(cct) << name << std::endl;
1346413462

1346513463
std::scoped_lock lock(client_lock);
13466-
rc = path_walk(cwd, fp, &in, perms, {.followsym = !(flags & AT_SYMLINK_NOFOLLOW), .mask = mask});
13467-
if (rc < 0) {
13464+
if (int rc = path_walk(cwd, filepath(name), &in, perms, {.followsym = !(flags & AT_SYMLINK_NOFOLLOW), .mask = mask}); rc < 0) {
1346813465
/* zero out mask, just in case... */
1346913466
stx->stx_mask = 0;
1347013467
stx->stx_ino = 0;

src/test/client/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ if(${WITH_CEPHFS})
22
add_executable(ceph_test_client
33
main.cc
44
alternate_name.cc
5+
ll_api.cc
56
ops.cc
67
nonblocking.cc
78
commands.cc

src/test/client/ll_api.cc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2+
// vim: ts=8 sw=2 smarttab
3+
/*
4+
* Ceph - scalable distributed file system
5+
*
6+
* Copyright (C) 2025 IBM, Inc.
7+
*
8+
* This is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License version 2.1, as published by the Free Software
11+
* Foundation. See file COPYING.
12+
*
13+
*/
14+
15+
#include <errno.h>
16+
17+
#include <iostream>
18+
#include <string>
19+
20+
#include <fmt/format.h>
21+
22+
#include "test/client/TestClient.h"
23+
24+
TEST_F(TestClient, LL_Walk) {
25+
auto dir = fmt::format("/{}_{}", ::testing::UnitTest::GetInstance()->current_test_info()->name(), getpid());
26+
ASSERT_EQ(0, client->mkdir(dir.c_str(), 0777, myperm));
27+
28+
ASSERT_EQ(0, client->chdir(dir.c_str(), myperm));
29+
std::string cwd;
30+
ASSERT_EQ(0, client->getcwd(cwd, myperm));
31+
ASSERT_STREQ(cwd.c_str(), dir.c_str());
32+
33+
Inode* in = nullptr;
34+
struct ceph_statx xbuf;
35+
ASSERT_EQ(0, client->ll_walk(dir.c_str(), &in, &xbuf, 0, 0, myperm));
36+
37+
ASSERT_EQ(0, client->rmdir(dir.c_str(), myperm));
38+
}

0 commit comments

Comments
 (0)