Skip to content

Commit aa6ffa5

Browse files
committed
client: check if inode ref is dir before proceeding with lookup
Lookup on non-dir inode is incorrect. Client::_lookup did check for it but the order needed to be correct i.e. check for non-dir inode before anything. Fixes: https://tracker.ceph.com/issues/70553 Signed-off-by: Dhairya Parmar <[email protected]>
1 parent 23b6b43 commit aa6ffa5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/client/Client.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7517,6 +7517,11 @@ int Client::_lookup(const InodeRef& dir, const std::string& name, std::string& a
75177517
mask &= CEPH_CAP_ANY_SHARED | CEPH_STAT_RSTAT;
75187518
std::string dname = name;
75197519

7520+
if (!dir->is_dir()) {
7521+
r = -ENOTDIR;
7522+
goto done;
7523+
}
7524+
75207525
if (dname == ".."sv) {
75217526
if (dir->dentries.empty()) {
75227527
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPPARENT);
@@ -7543,11 +7548,6 @@ int Client::_lookup(const InodeRef& dir, const std::string& name, std::string& a
75437548
goto done;
75447549
}
75457550

7546-
if (!dir->is_dir()) {
7547-
r = -ENOTDIR;
7548-
goto done;
7549-
}
7550-
75517551
if (dname.size() > NAME_MAX) {
75527552
r = -ENAMETOOLONG;
75537553
goto done;

0 commit comments

Comments
 (0)