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: do not run modprobe if support is compiled into the kernel #4378

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

nixpanic
Copy link
Member

By reading the contents of /proc/filesystems, and checking if "ceph" is
included there, running "modprobe ceph" can be skipped.

Fixes: #4376
Signed-off-by: Niels de Vos [email protected]

@mergify mergify bot added the component/cephfs Issues related to CephFS label Jan 16, 2024
@nixpanic nixpanic added bug Something isn't working backport-to-release-v3.10 Label to backport from devel to release-v3.10 branch labels Jan 16, 2024
@nixpanic nixpanic requested a review from a team January 16, 2024 17:22
Comment on lines +68 to +70
if err := execCommandErr(ctx, "modprobe", kernelModule); err != nil {
return err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we can optimize it by moving this modeprobe to NewKernelMounter so that we run it only once when driver starts not always WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a check to see if the driver is loaded when NewKernelMounter() is called. That sets m.needsModprobe. It is done so that NewKernelMounter() does not need to return an error, keeping other changes minimal.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i agree but this works byt when where a mountKernel is called and if needsModprobe not set we keep on running modeprobe, but running that can be avoided if we set needsModprobe to true on successful run of modprobe,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can take it as an enhancement as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, if modprobe succeeded, it should be set to true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is done now, please review again.

@nixpanic nixpanic requested a review from Madhu-1 January 17, 2024 08:53
Madhu-1
Madhu-1 previously approved these changes Jan 17, 2024
Comment on lines +68 to +70
if err := execCommandErr(ctx, "modprobe", kernelModule); err != nil {
return err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i agree but this works byt when where a mountKernel is called and if needsModprobe not set we keep on running modeprobe, but running that can be avoided if we set needsModprobe to true on successful run of modprobe,

)

type KernelMounter struct{}
// testErrorf can be set by unit test for enhanced error reporting.
var testErrorf = func(fmt string, args ...any) { /* do nothing */ }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testErrorf might not be the right name for non-test file and also fmt can be replaced to something else as its a core package name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I understand, fmt is just a string?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what i mean is that fmt is also a package name, we might get into a static check problem if we use the same name for some variable name as well.

Comment on lines +68 to +70
if err := execCommandErr(ctx, "modprobe", kernelModule); err != nil {
return err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can take it as an enhancement as well.

return err
}

m.needsModprobe = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this needs to be set to true? also this is not of much use with the current code because mounter.New() is called for every NodeStage RPC call. we need to move this to Driver initialization time as it needs to run only one time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once the module is loaded, it will be listed in /proc/filesystems, so eventually modprobe is only run once

@nixpanic nixpanic requested a review from a team January 17, 2024 10:03
@nixpanic
Copy link
Member Author

@Mergifyio rebase

By reading the contents of /proc/filesystems, and checking if "ceph" is
included there, running "modprobe ceph" can be skipped.

Fixes: ceph#4376
Signed-off-by: Niels de Vos <[email protected]>
Copy link
Contributor

mergify bot commented Jan 17, 2024

rebase

✅ Branch has been successfully rebased

@nixpanic
Copy link
Member Author

@Mergifyio queue

Copy link
Contributor

mergify bot commented Jan 17, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at ab87045

@mergify mergify bot added the ok-to-test Label to trigger E2E tests label Jan 17, 2024
@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.29

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.29

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.29

@ceph-csi-bot ceph-csi-bot removed the ok-to-test Label to trigger E2E tests label Jan 17, 2024
@mergify mergify bot merged commit ab87045 into ceph:devel Jan 17, 2024
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-release-v3.10 Label to backport from devel to release-v3.10 branch bug Something isn't working component/cephfs Issues related to CephFS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kernel mounter refuses to mount when cephfs is built into kernel
4 participants