Skip to content

Commit

Permalink
curvefs/client: fix readdirplus return inode attr error in hardlink s…
Browse files Browse the repository at this point in the history
…cene

Signed-off-by: wanghai01 <[email protected]>
  • Loading branch information
SeanHai committed Aug 1, 2022
1 parent 937e750 commit 40d1d19
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions curvefs/src/client/fuse_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void FuseClient::FuseOpDestroy(void *userdata) {
return;
}

void InodeAttr2ParamAttr(InodeAttr inodeAttr, struct stat *attr) {
void InodeAttr2ParamAttr(const InodeAttr &inodeAttr, struct stat *attr) {
attr->st_ino = inodeAttr.inodeid();
attr->st_mode = inodeAttr.mode();
attr->st_nlink = inodeAttr.nlink();
Expand Down Expand Up @@ -271,12 +271,12 @@ void InodeAttr2ParamAttr(InodeAttr inodeAttr, struct stat *attr) {

void GetDentryParamFromInodeAttr(
const FuseClientOption &option,
InodeAttr inodeAttr,
const InodeAttr &inodeAttr,
fuse_entry_param *param) {
memset(param, 0, sizeof(fuse_entry_param));
param->ino = inodeAttr.inodeid();
param->generation = 0;
InodeAttr2ParamAttr(std::move(inodeAttr), &param->attr);
InodeAttr2ParamAttr(inodeAttr, &param->attr);
param->attr_timeout = option.attrTimeOut;
param->entry_timeout = option.entryTimeOut;
}
Expand Down Expand Up @@ -309,7 +309,7 @@ CURVEFS_ERROR FuseClient::FuseOpLookup(fuse_req_t req, fuse_ino_t parent,
return ret;
}

GetDentryParamFromInodeAttr(option_, std::move(attr), e);
GetDentryParamFromInodeAttr(option_, attr, e);
return ret;
}

Expand Down Expand Up @@ -499,7 +499,7 @@ CURVEFS_ERROR FuseClient::MakeNode(fuse_req_t req, fuse_ino_t parent,

InodeAttr attr;
inodeWrapper->GetInodeAttrLocked(&attr);
GetDentryParamFromInodeAttr(option_, std::move(attr), e);
GetDentryParamFromInodeAttr(option_, attr, e);
return ret;
}

Expand Down Expand Up @@ -651,7 +651,7 @@ static void dirbuf_add(fuse_req_t req, struct DirBufferHead *b,
b->size += fuse_add_direntry_plus(req, NULL, 0, dentry.name().c_str(),
NULL, 0);
b->p = static_cast<char *>(realloc(b->p, b->size));
GetDentryParamFromInodeAttr(option, std::move(*attr), &param);
GetDentryParamFromInodeAttr(option, *attr, &param);
fuse_add_direntry_plus(req, b->p + oldsize, b->size - oldsize,
dentry.name().c_str(), &param, b->size);
}
Expand Down Expand Up @@ -780,7 +780,7 @@ CURVEFS_ERROR FuseClient::FuseOpGetAttr(fuse_req_t req, fuse_ino_t ino,
<< ", inodeid = " << ino;
return ret;
}
InodeAttr2ParamAttr(std::move(inodeAttr), attr);
InodeAttr2ParamAttr(inodeAttr, attr);
return ret;
}

Expand Down Expand Up @@ -851,7 +851,7 @@ CURVEFS_ERROR FuseClient::FuseOpSetAttr(fuse_req_t req, fuse_ino_t ino,
}
InodeAttr inodeAttr;
inodeWrapper->GetInodeAttrUnlocked(&inodeAttr);
InodeAttr2ParamAttr(std::move(inodeAttr), attrOut);
InodeAttr2ParamAttr(inodeAttr, attrOut);

if (enableSumInDir_ && changeSize != 0) {
// update parent summary info
Expand All @@ -877,7 +877,7 @@ CURVEFS_ERROR FuseClient::FuseOpSetAttr(fuse_req_t req, fuse_ino_t ino,
}
InodeAttr inodeAttr;
inodeWrapper->GetInodeAttrUnlocked(&inodeAttr);
InodeAttr2ParamAttr(std::move(inodeAttr), attrOut);
InodeAttr2ParamAttr(inodeAttr, attrOut);
return ret;
}

Expand Down Expand Up @@ -1079,7 +1079,7 @@ CURVEFS_ERROR FuseClient::FuseOpSymlink(fuse_req_t req, const char *link,

InodeAttr attr;
inodeWrapper->GetInodeAttrLocked(&attr);
GetDentryParamFromInodeAttr(option_, std::move(attr), e);
GetDentryParamFromInodeAttr(option_, attr, e);
return ret;
}

Expand Down Expand Up @@ -1150,7 +1150,7 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req, fuse_ino_t ino,

InodeAttr attr;
inodeWrapper->GetInodeAttrLocked(&attr);
GetDentryParamFromInodeAttr(option_, std::move(attr), e);
GetDentryParamFromInodeAttr(option_, attr, e);
return ret;
}

Expand Down
8 changes: 4 additions & 4 deletions curvefs/src/client/inode_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {

CURVEFS_ERROR SyncS3ChunkInfo(bool internal = false);

uint64_t CalS3ChunkInfoSize() {
uint64_t size = 0;
int64_t CalS3ChunkInfoSize() {
int64_t size = 0;
for (const auto &it : inode_.s3chunkinfomap()) {
size += it.second.s3chunks_size();
}
Expand Down Expand Up @@ -448,8 +448,8 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {
bool isNlinkValid_;

google::protobuf::Map<uint64_t, S3ChunkInfoList> s3ChunkInfoAdd_;
uint64_t s3ChunkInfoAddSize_;
uint64_t s3ChunkInfoSize_;
int64_t s3ChunkInfoAddSize_;
int64_t s3ChunkInfoSize_;

std::shared_ptr<MetaServerClient> metaClient_;
std::shared_ptr<S3ChunkInfoMetric> s3ChunkInfoMetric_;
Expand Down

0 comments on commit 40d1d19

Please sign in to comment.