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 <dparmar@redhat.com>
(cherry picked from commit
aa6ffa5159f6c9e14000a7501a394b1185b63078)
mask &= CEPH_CAP_ANY_SHARED | CEPH_STAT_RSTAT;
std::string dname = name;
+ if (!dir->is_dir()) {
+ r = -ENOTDIR;
+ goto done;
+ }
+
if (dname == ".."sv) {
if (dir->dentries.empty()) {
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPPARENT);
goto done;
}
- if (!dir->is_dir()) {
- r = -ENOTDIR;
- goto done;
- }
-
if (dname.size() > NAME_MAX) {
r = -ENAMETOOLONG;
goto done;