juicedata/juicefs · error
set total inodes: %w
Error message
set total inodes: %w
What it means
After recomputing total inodes/used space (quota usage sync), kvMeta persists the total-inode counter; if that setValue fails, the store error is wrapped as 'set total inodes: %w'. The subsequent usedSpace write is skipped, leaving counters potentially inconsistent until the next sync.
Source
Thrown at pkg/meta/tkv.go:3655
return nil
})
}
func (m *kvMeta) doSyncVolumeStat(ctx Context, used, inodes int64) error {
if m.conf.ReadOnly {
return syscall.EROFS
}
if err := m.doScanSustainedInodes(ctx, func(uid, gid uint32, length uint64) error {
used += align4K(length)
inodes++
return nil
}); err != nil {
return err
}
logger.Debugf("Used space: %s, inodes: %d", humanize.IBytes(uint64(used)), inodes)
err := m.setValue(m.counterKey(totalInodes), packCounter(inodes))
if err != nil {
return fmt.Errorf("set total inodes: %w", err)
}
return m.setValue(m.counterKey(usedSpace), packCounter(used))
}
func (m *kvMeta) doFlushQuotas(ctx Context, quotas []*iQuota) error {
return m.txn(ctx, func(tx *kvTxn) error {
keys := make([][]byte, 0, len(quotas))
qs := make([]*iQuota, 0, len(quotas))
for _, q := range quotas {
key, err := m.getQuotaKey(q.qtype, q.qkey)
if err != nil {
return err
}
keys = append(keys, key)
qs = append(qs, q)
}
for i, v := range tx.gets(keys...) {
if len(v) == 0 {View on GitHub (pinned to c9a67b23e8)
Solutions
- Re-run the usage sync command (juicefs gc/ quota sync) once the metadata store is healthy
- Check the wrapped inner error for the store-level cause (connectivity, readonly, txn limits)
- Verify the KV store is writable (not in readonly/maintenance mode) and has enough request-size headroom
- Retry with backoff; the operation is idempotent since it recomputes from counters
Defensive patterns
Strategy: retry
Validate before calling
// verify store writability before syncing quota usage
if err := canWriteCounterKey(ctx, meta); err != nil {
return fmt.Errorf("metadata store not writable: %w", err)
} Try / catch
if err := syncUsage(ctx); err != nil {
if strings.Contains(err.Error(), "set total inodes") {
// retry with backoff; operation recomputes and is idempotent
}
} Prevention
- Ensure the KV store has adequate transaction/request size limits
- Monitor store availability during gc/quota sync windows
- Retry failed syncs; counters are recomputed from scratch
- Check for readonly/leader-election states in etcd/TiKV
When it happens
Trigger: Quota usage flush/sync (e.g. 'juicefs gc --sync' or periodic usage sync) failing to write the totalInodes counter key — store outage, transaction size limit, network error.
Common situations: etcd transaction size limits under large syncs; temporary metadata store unavailability; leader election/readonly mode in TiKV/etcd during the write.
Related errors
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/8efd58feefa7d526.
Report an issue: GitHub.