Change:
break } } <ins> } else { // ReadOnly rbd volume should not check rbd status of being used to // support mounted as read-only by multiple consumers simultaneously. needValidUsed = !b.rbd.ReadOnly </ins> } err := wait.ExponentialBackoff(backoff, func() (bool, error) { used, rbdOutput, err := util.rbdStatus(&b)

Discussion:
<!-- This form is for bug reports and feature requests ONLY! If you're looking for help check and the . If this may be security issue, please disclose it privately via --Is this a BUG REPORT or FEATURE REQUEST?: What happened: I created a job with parallelism=2, 1 container in each pod, and a rbd volume attached to the container. Attachment was read-only. Only 1 pod got the RBD mounted while the other POD failed with "still in use" in syslog, referencing the code in that checks watchers. Note that this is not the same thing as this: which refers to persistent volumes. This is not a persistent volume -the use case is to map read-only data to multiple containers from a single RBD, like for using a reference data set, etc. According to the documentation this should work (see below). What you expected to happen: I expect this to happen per the documentation: "A feature of RBD is that it can be mounted as read-only by multiple consumers simultaneously. This means that you can pre-populate a volume with your dataset and then serve it in parallel from as many Pods as you need. Unfortunately, RBD volumes can only be mounted by a single consumer in read-write mode - no simultaneous writers allowed." How to reproduce it (as minimally and precisely as possible): Create 2 pods, each with 1 container mapping a single rbd read only. Anything else we need to know?: Environment: Kubernetes version (use ): 4 Cloud provider or hardware configuration: self, x8664 systems OS (e.g. from /etc/os-release): Ubuntu Xenial Kernel (e.g. ): Linux dal1util6p30 4.4.0-116-generic -Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x8664 x8664 x86_64 GNU/Linux Install tools: ceph Others: I believe that in the case where a read-only mapping is being requested, the code should not check watchers. Again this is consistent with the documentation but it doesn't work that way. If a PV/PVC is the "right" way to do this it seems seriously overkill and the management overhead is severe, especially in a large scale environment.

The documentation states that the advantage of RBD is to be able to attach read-only volumes to multiple containers concurrently, and this is how I believe it should work. The watcher check is artificial and really needs to apply only to read/write. I can fix this bug myself but would like to understand the reasoning behind it a bit more. Thanks! Leo Reiter
/sig
Reiterating the mentions to trigger a notification: <detailsIn response to : /sig Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
Reiterating the mentions to trigger a notification: <detailsIn response to : /sig Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
I will check the problem.
/assign