Skip to content

Commit b667ee4

Browse files
Daniil Tulinkahing
authored andcommitted
Fix stat checking for cgroup
1 parent e903e56 commit b667ee4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

api/common/panic_logger.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ type FusePanicLogger struct {
2727
Fs fuseutil.FileSystem
2828
}
2929

30+
var _ fuseutil.FileSystem = FusePanicLogger{}
31+
3032
func LogPanic(err *error) {
3133
if e := recover(); e != nil {
3234
log.Errorf("stacktrace from panic: %v \n"+string(debug.Stack()), e)
@@ -36,6 +38,11 @@ func LogPanic(err *error) {
3638
}
3739
}
3840

41+
func (fs FusePanicLogger) BatchForget(ctx context.Context, op *fuseops.BatchForgetOp) (err error) {
42+
defer LogPanic(&err)
43+
return fs.Fs.BatchForget(ctx, op)
44+
}
45+
3946
func (fs FusePanicLogger) StatFS(ctx context.Context, op *fuseops.StatFSOp) (err error) {
4047
defer LogPanic(&err)
4148
return fs.Fs.StatFS(ctx, op)

internal/cgroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func getCgroupAvailableMem() (retVal uint64, err error) {
4545

4646
// newer version of docker mounts the cgroup memory limit/usage files directly under
4747
// /sys/fs/cgroup/memory/ rather than /sys/fs/cgroup/memory/docker/$container_id/
48-
if _, err := os.Stat(filepath.Join(CGROUP_FOLDER_PREFIX, path)); os.IsExist(err) {
48+
if _, err := os.Stat(filepath.Join(CGROUP_FOLDER_PREFIX, path)); err == nil {
4949
path = filepath.Join(CGROUP_FOLDER_PREFIX, path)
5050
} else {
5151
path = filepath.Join(CGROUP_FOLDER_PREFIX)

0 commit comments

Comments
 (0)