Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cephfs: make volOptions.GetConnection() safer to use #5129

Open
nixpanic opened this issue Feb 7, 2025 · 0 comments
Open

cephfs: make volOptions.GetConnection() safer to use #5129

nixpanic opened this issue Feb 7, 2025 · 0 comments

Comments

@nixpanic
Copy link
Member

nixpanic commented Feb 7, 2025

          > volOptions.GetConnection() can return nil, so it is not really safe. A new GetFSID() would prevent any incorrect usage, now, and possibly in the future.

when volOptions struct is created, we make sure we have the connection set. There is no way GetConnection() could return nil.

IMO, GetConnection() should be handling the nil check, or the GetConnection() caller should check for nil and proceed.

as we have similar usage at some places. for example -

ioctx, err := volOptions.GetConnection().GetIoctx(volOptions.MetadataPool)
if err != nil {
log.ErrorLog(ctx, "Failed to create ioctx: %s", err)
return err
}
defer ioctx.Destroy()

Originally posted by @iPraveenParihar in #5090 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant