Skip to content

Commit 8e8a598

Browse files
authored
Configure XFS max-retry=1 max-timeout=5 for EIO/ENOSPC errors (#753)
Signed-off-by: Bala.FA <bala@minio.io>
1 parent de23fc4 commit 8e8a598

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

apparmor.profile

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ profile directpv flags=(attach_disconnected,mediate_deleted) {
3434
/var/lib/directpv/** w,
3535
/var/lib/kubelet/** w,
3636
/csi/** w,
37+
/sys/fs/xfs/**/error/metadata/{EIO,ENOSPC}/retry_timeout_seconds rw,
3738

3839
# only a limited set of binaries can be executed
3940
/usr/sbin/mkfs ix,

pkg/installer/daemonset.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func getVolumesAndMounts(pluginSocketDir string) (volumes []corev1.Volume, volum
111111
newVolumeMount(volumeNameMountpointDir, kubeletDirPath+"/pods", corev1.MountPropagationBidirectional, false),
112112
newVolumeMount(volumeNamePluginDir, kubeletDirPath+"/plugins", corev1.MountPropagationBidirectional, false),
113113
newVolumeMount(volumeNameAppRootDir, appRootDir, corev1.MountPropagationBidirectional, false),
114-
newVolumeMount(volumeNameSysDir, volumePathSysDir, corev1.MountPropagationBidirectional, true),
114+
newVolumeMount(volumeNameSysDir, volumePathSysDir, corev1.MountPropagationBidirectional, false),
115115
newVolumeMount(volumeNameDevDir, volumePathDevDir, corev1.MountPropagationHostToContainer, true),
116116
newVolumeMount(volumeNameRunUdevData, volumePathRunUdevData, corev1.MountPropagationBidirectional, true),
117117
newVolumeMount(volumeNameLegacyAppRootDir, legacyAppRootDir, corev1.MountPropagationBidirectional, false),

pkg/installer/psp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func createPodSecurityPolicy(ctx context.Context, args *Args) (err error) {
155155
Volumes: []policy.FSType{policy.HostPath},
156156
AllowedHostPaths: []policy.AllowedHostPath{
157157
{PathPrefix: "/proc", ReadOnly: true},
158-
{PathPrefix: volumePathSysDir, ReadOnly: true},
158+
{PathPrefix: volumePathSysDir},
159159
{PathPrefix: consts.UdevDataDir, ReadOnly: true},
160160
{PathPrefix: consts.AppRootDir},
161161
{PathPrefix: socketDir},

pkg/xfs/mount_linux.go

+30-2
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,44 @@ package xfs
2121
import (
2222
"errors"
2323
"os"
24+
"path"
2425

2526
"github.com/minio/directpv/pkg/sys"
27+
"k8s.io/klog/v2"
2628
)
2729

2830
func mount(device, target string) error {
29-
if err := os.Mkdir(target, 0o777); err != nil && !errors.Is(err, os.ErrExist) {
31+
if err := sys.Mkdir(target, 0o777); err != nil && !errors.Is(err, os.ErrExist) {
3032
return err
3133
}
3234

33-
return sys.Mount(device, target, "xfs", []string{"noatime"}, "prjquota")
35+
if err := sys.Mount(device, target, "xfs", []string{"noatime"}, "prjquota"); err != nil {
36+
return err
37+
}
38+
39+
name := path.Base(device)
40+
if name == "/" || name == "." {
41+
klog.Errorf("unable to get device name from device %v", device)
42+
return nil
43+
}
44+
45+
if err := os.WriteFile("/sys/fs/xfs/"+name+"/error/metadata/EIO/max_retries", []byte("1"), 0o644); err != nil {
46+
klog.ErrorS(err, "unable to set EIO max_retires device", "name", name)
47+
}
48+
49+
if err := os.WriteFile("/sys/fs/xfs/"+name+"/error/metadata/EIO/retry_timeout_seconds", []byte("5"), 0o644); err != nil {
50+
klog.ErrorS(err, "unable to set EIO retry_timeout_seconds for device", "name", name)
51+
}
52+
53+
if err := os.WriteFile("/sys/fs/xfs/"+name+"/error/metadata/ENOSPC/max_retries", []byte("1"), 0o644); err != nil {
54+
klog.ErrorS(err, "unable to set ENOSPC max_retires device", "name", name)
55+
}
56+
57+
if err := os.WriteFile("/sys/fs/xfs/"+name+"/error/metadata/ENOSPC/retry_timeout_seconds", []byte("5"), 0o644); err != nil {
58+
klog.ErrorS(err, "unable to set ENOSPC retry_timeout_seconds for device", "name", name)
59+
}
60+
61+
return nil
3462
}
3563

3664
func bindMount(source, target string, readOnly bool) error {

0 commit comments

Comments
 (0)