From e39c4a69aaaea6fbdc6442e400225e7253e00cd4 Mon Sep 17 00:00:00 2001 From: Sandy Xu Date: Wed, 1 Nov 2023 13:41:04 +0800 Subject: [PATCH] meta: skip cleaning session when sid is 0 (#4133) --- pkg/meta/base.go | 8 ++++++-- pkg/meta/sql.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/meta/base.go b/pkg/meta/base.go index 3fb6d73474db..5beb3a763cc1 100644 --- a/pkg/meta/base.go +++ b/pkg/meta/base.go @@ -613,8 +613,12 @@ func (m *baseMeta) CloseSession() error { m.sesMu.Lock() m.umounting = true m.sesMu.Unlock() - logger.Infof("close session %d: %s", m.sid, m.en.doCleanStaleSession(m.sid)) - return nil + var err error + if m.sid > 0 { + err = m.en.doCleanStaleSession(m.sid) + } + logger.Infof("close session %d: %s", m.sid, err) + return err } func (m *baseMeta) checkQuota(ctx Context, space, inodes int64, parents ...Ino) syscall.Errno { diff --git a/pkg/meta/sql.go b/pkg/meta/sql.go index 6207bb75579b..783ef796bba4 100644 --- a/pkg/meta/sql.go +++ b/pkg/meta/sql.go @@ -2057,7 +2057,7 @@ func (m *dbMeta) doCleanStaleSession(sid uint64) error { return nil }) if err != nil { - logger.Warnf("Delete flock/plock with sid %d: %d", sid, err) + logger.Warnf("Delete flock/plock with sid %d: %s", sid, err) fail = true }