fix(fsck): fix nil pointer when get partition info

close:#22709584
Signed-off-by: true1064 <tangjingyu@oppo.com>
This commit is contained in:
true1064 2024-10-22 14:39:09 +08:00 committed by AmazingChi
parent d09a0d21e4
commit 17b4921396
2 changed files with 14 additions and 11 deletions

View File

@ -516,17 +516,19 @@ func getExtentsByMpId(dir string, volname string, mpId string) {
}
// handle migrate extents
sme := ino.HybridCouldExtentsMigration.GetSortedEks()
if sme != nil {
if proto.IsStorageClassReplica(ino.HybridCouldExtentsMigration.GetStorageClass()) {
replicaMigrateExtents := sme.(*metanode.SortedExtents)
walkBuf = normalMigrateBuf
replicaMigrateExtents.Range(walkFunc)
if ino.HybridCouldExtentsMigration != nil {
sme := ino.HybridCouldExtentsMigration.GetSortedEks()
if sme != nil {
if proto.IsStorageClassReplica(ino.HybridCouldExtentsMigration.GetStorageClass()) {
replicaMigrateExtents := sme.(*metanode.SortedExtents)
walkBuf = normalMigrateBuf
replicaMigrateExtents.Range(walkFunc)
}
// TODO: handle other impl type of HybridCouldExtentsMigration
} else {
log.LogDebugf("HybridCouldExtentsMigration is nil, mpId(%v) inode(%v) host(%v) storageClass(%v)",
mpId, ino.Inode, addr, proto.StorageClassString(ino.HybridCouldExtentsMigration.GetStorageClass()))
}
// TODO: handle other impl type of HybridCouldExtentsMigration
} else {
log.LogDebugf("HybridCouldExtentsMigration is nil, mpId(%v) inode(%v) host(%v) storageClass(%v)",
mpId, ino.Inode, addr, proto.StorageClassString(ino.HybridCouldExtentsMigration.GetStorageClass()))
}
}
}

View File

@ -215,7 +215,8 @@ func getDataPartitions(addr, name string) ([]*proto.DataPartitionResponse, error
if err != nil {
return nil, fmt.Errorf("decompress data partitions failed: %+v", err)
}
var dpv *proto.DataPartitionsView
dpv := &proto.DataPartitionsView{}
if err = proto.UnmarshalHTTPReply(data, dpv); err != nil {
return nil, fmt.Errorf("Unmarshal data partitions view failed: %v", err)
}