mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-04-11 18:13:00 +00:00
rbd: fix rbd-nbd io-timeout to never abort
With the tests at CI, it kind of looks like that the IO is timing out after 30 seconds (default with rbd-nbd). Since we have tweaked reattach-timeout to 300 seconds at ceph-csi, we need to explicitly set io-timeout on the device too, as it doesn't make any sense to keep io-timeout < reattach-timeout Hence we set io-timeout for rbd nbd to 0. Specifying io-timeout 0 tells the nbd driver to not abort the request and instead see if it can be restarted on another socket. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Suggested-by: Ilya Dryomov <idryomov@redhat.com>
This commit is contained in:
parent
3bf17ade7a
commit
4f40213d8e
@ -49,6 +49,7 @@ const (
|
|||||||
rbdMapConnectionTimeout = "Connection timed out"
|
rbdMapConnectionTimeout = "Connection timed out"
|
||||||
|
|
||||||
defaultNbdReAttachTimeout = 300 /* in seconds */
|
defaultNbdReAttachTimeout = 300 /* in seconds */
|
||||||
|
defaultNbdIOTimeout = 0 /* do not abort the requests */
|
||||||
|
|
||||||
// The default way of creating nbd devices via rbd-nbd is through the
|
// The default way of creating nbd devices via rbd-nbd is through the
|
||||||
// legacy ioctl interface, to take advantage of netlink features we
|
// legacy ioctl interface, to take advantage of netlink features we
|
||||||
@ -59,6 +60,10 @@ const (
|
|||||||
// It specifies how long the device should be held waiting for the
|
// It specifies how long the device should be held waiting for the
|
||||||
// userspace process to come back to life.
|
// userspace process to come back to life.
|
||||||
setNbdReattach = "reattach-timeout"
|
setNbdReattach = "reattach-timeout"
|
||||||
|
|
||||||
|
// `io-timeout` of rbd-nbd is to tweak NBD_ATTR_TIMEOUT. It specifies
|
||||||
|
// how long the IO should wait to get handled before bailing out.
|
||||||
|
setNbdIOTimeout = "io-timeout"
|
||||||
)
|
)
|
||||||
|
|
||||||
var hasNBD = false
|
var hasNBD = false
|
||||||
@ -256,6 +261,9 @@ func appendDeviceTypeAndOptions(cmdArgs []string, isNbd, isThick bool, userOptio
|
|||||||
if !strings.Contains(userOptions, setNbdReattach) {
|
if !strings.Contains(userOptions, setNbdReattach) {
|
||||||
cmdArgs = append(cmdArgs, "--options", fmt.Sprintf("%s=%d", setNbdReattach, defaultNbdReAttachTimeout))
|
cmdArgs = append(cmdArgs, "--options", fmt.Sprintf("%s=%d", setNbdReattach, defaultNbdReAttachTimeout))
|
||||||
}
|
}
|
||||||
|
if !strings.Contains(userOptions, setNbdIOTimeout) {
|
||||||
|
cmdArgs = append(cmdArgs, "--options", fmt.Sprintf("%s=%d", setNbdIOTimeout, defaultNbdIOTimeout))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if isThick {
|
if isThick {
|
||||||
// When an image is thick-provisioned, any discard/unmap/trim
|
// When an image is thick-provisioned, any discard/unmap/trim
|
||||||
@ -280,6 +288,9 @@ func appendRbdNbdCliOptions(cmdArgs []string, userOptions string) []string {
|
|||||||
if !strings.Contains(userOptions, setNbdReattach) {
|
if !strings.Contains(userOptions, setNbdReattach) {
|
||||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--%s=%d", setNbdReattach, defaultNbdReAttachTimeout))
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--%s=%d", setNbdReattach, defaultNbdReAttachTimeout))
|
||||||
}
|
}
|
||||||
|
if !strings.Contains(userOptions, setNbdIOTimeout) {
|
||||||
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--%s=%d", setNbdIOTimeout, defaultNbdIOTimeout))
|
||||||
|
}
|
||||||
if userOptions != "" {
|
if userOptions != "" {
|
||||||
options := strings.Split(userOptions, ",")
|
options := strings.Split(userOptions, ",")
|
||||||
for _, opt := range options {
|
for _, opt := range options {
|
||||||
|
Loading…
Reference in New Issue
Block a user