Skip to content

Commit c877712

Browse files
rock-gitchuandew
authored andcommitted
[feat][mdsv2] Add file session page and fixup known issues.
1 parent b8f0487 commit c877712

File tree

17 files changed

+386
-139
lines changed

17 files changed

+386
-139
lines changed

proto

src/client/vfs/meta/v2/filesystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ Status MDSV2FileSystem::MkNod(Ino parent, const std::string& name, uint32_t uid,
336336
}
337337

338338
Status MDSV2FileSystem::Open(Ino ino, int flags, uint64_t fh) {
339-
LOG(INFO) << fmt::format("[meta.{}] open ino({}).", name_, ino);
339+
LOG(INFO) << fmt::format("[meta.{}] open ino({}) flags({}).", name_, ino,
340+
flags);
340341

341342
if ((flags & O_TRUNC) && !(flags & O_WRONLY || flags & O_RDWR)) {
342343
return Status::NoPermission("O_TRUNC without O_WRONLY or O_RDWR");

src/client/vfs/meta/v2/mds_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ Status MDSClient::SetAttr(Ino ino, const Attr& attr, int to_set,
607607
}
608608

609609
if (to_set & kSetAttrSize) {
610-
// todo: Truncate data
611610
request.set_length(attr.length);
611+
temp_to_set |= mdsv2::kSetAttrLength;
612612
}
613613

614614
request.set_to_set(temp_to_set);

src/client/vfs/vfs_impl.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,14 @@ Status VFSImpl::Write(Ino ino, const char* buf, uint64_t size, uint64_t offset,
243243

244244
Status VFSImpl::Flush(Ino ino, uint64_t fh) { return Status::OK(); }
245245

246-
Status VFSImpl::Release(Ino ino, uint64_t fh) { return Status::OK(); }
246+
Status VFSImpl::Release(Ino ino, uint64_t fh) {
247+
auto s = meta_system_->Close(ino, fh);
248+
if (!s.ok()) {
249+
handle_manager_->ReleaseHandler(fh);
250+
}
251+
252+
return Status::OK();
253+
}
247254

248255
Status VFSImpl::Fsync(Ino ino, int datasync, uint64_t fh) {
249256
return Status::OK();

0 commit comments

Comments
 (0)