Skip to content

Commit d629846

Browse files
authored
Don't emit an error log if source mount dir does not exists in CleanupDanglingMounts (#452)
This causes some error logs to be emitted if there are no S3 volumes in-use currently, this change prevents that. --- By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. Signed-off-by: Burak Varlı <burakvar@amazon.co.uk>
1 parent 303215a commit d629846

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pkg/driver/node/mounter/pod_unmounter.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package mounter
22

33
import (
4+
"errors"
5+
"io/fs"
46
"os"
57
"path/filepath"
68
"sync"
@@ -160,7 +162,12 @@ func (u *PodUnmounter) CleanupDanglingMounts() error {
160162

161163
entries, err := os.ReadDir(u.sourceMountDir)
162164
if err != nil {
163-
klog.Errorf("Failed to read source mount directory (`%s`): %v", u.sourceMountDir, err)
165+
// Source mount dir does not exists, meaning there aren't any mounts
166+
if errors.Is(err, fs.ErrNotExist) {
167+
return nil
168+
}
169+
170+
klog.Errorf("Failed to read source mount directory %q: %v", u.sourceMountDir, err)
164171
return err
165172
}
166173

0 commit comments

Comments
 (0)