Skip to content

Commit 4409626

Browse files
committed
minor(locking): Remove ComID validation
Some drives (e.g. Seagate 7E2000) does not validate the BaseComIDs.
1 parent e9ae585 commit 4409626

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

pkg/locking/locking.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,10 @@ func findComID(d core.DriveIntf, d0 *core.Level0Discovery) (core.ComID, core.Pro
164164
}
165165

166166
autoComID, err := core.GetComID(d)
167-
if err == nil {
167+
if err == nil && autoComID > 0 {
168168
comID = autoComID
169169
}
170170

171-
valid, err := core.IsComIDValid(d, comID)
172-
if err != nil {
173-
return core.ComIDInvalid, core.ProtocolLevelUnknown, fmt.Errorf("comID validation failed: %v", err)
174-
}
175-
176-
if !valid {
177-
return core.ComIDInvalid, core.ProtocolLevelUnknown, fmt.Errorf("allocated comID was not valid")
178-
}
179-
180171
return comID, proto, nil
181172
}
182173

@@ -200,9 +191,12 @@ func Initialize(d core.DriveIntf, opts ...InitializeOpt) (*core.ControlSession,
200191
lmeta.D0 = d0
201192

202193
comID, proto, err := findComID(d, d0)
194+
if err != nil {
195+
return nil, nil, err
196+
}
203197
cs, err := core.NewControlSession(d, d0, core.WithComID(comID))
204198
if err != nil {
205-
return nil, nil, fmt.Errorf("failed to create control session: %v", err)
199+
return nil, nil, fmt.Errorf("failed to create control session (comID 0x%04x): %v", comID, err)
206200
}
207201

208202
as, err := cs.NewSession(core.AdminSP)

0 commit comments

Comments
 (0)