juicedata/juicefs · error

clean %s quotas: %w

Error message

clean %s quotas: %w

What it means

Raised by baseMeta.repairUgUsage (pkg/meta/quota.go:1042) when cleanUgUsage fails while repairing user/group quota usage. The wrapper means all existing uid/gid quota usage records could not be wiped in the metadata engine, so the subsequent repairUsage would produce a wrong mixed state and is skipped.

Source

Thrown at pkg/meta/quota.go:1042

		}
		if q, ok := quotaMap[id]; ok {
			quota.MaxSpace = q.MaxSpace
			quota.MaxInodes = q.MaxInodes
		}
		if _, err := m.en.doSetQuota(ctx, qtype, id, quota); err != nil {
			return err
		}
	}
	return nil
}

func (m *baseMeta) repairUgUsage(ctx Context, qtype uint32, usageMap map[uint64]*Summary, quotaMap map[uint64]*Quota) error {
	idType := "uid"
	if qtype == GroupQuotaType {
		idType = "gid"
	}
	if err := m.en.cleanUgUsage(ctx, qtype); err != nil {
		return fmt.Errorf("clean %s quotas: %w", idType, err)
	}
	if err := m.repairUsage(ctx, usageMap, quotaMap, qtype); err != nil {
		return fmt.Errorf("set %s quota: %w", idType, err)
	}
	return nil
}

func (m *baseMeta) checkUGUsage(ctx Context, repair bool, quotas map[string]*Quota) error {
	userUsage, groupUsage, err := m.scanGlobalUserGroupUsage(ctx)
	if err != nil {
		return fmt.Errorf("scan global user group usage: %w", err)
	}

	_, userQuotas, groupQuotas, err := m.en.doLoadQuotas(ctx)
	if err != nil {
		return fmt.Errorf("load user/group quotas: %w", err)
	}
	hasErr := m.compareUGUsage(userUsage, userQuotas, UserQuotaType, quotas)

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Check the wrapped underlying error (%w) for the backend failure cause and fix connectivity/credentials to the metadata engine.
  2. Retry `juicefs quota check --repair` once the metadata engine is healthy.
  3. If timeouts, run the repair against the engine directly sized appropriately (e.g. tune SQL timeouts) or reduce load.
  4. Fall back to per-id repair if global clean keeps failing.

Example fix

// before: repair fails while backend unreachable
$ juicefs quota check --repair --uid 1000 /mnt/jfs
// fix backend, then:
$ juicefs quota check --repair --uid 1000 /mnt/jfs  # succeeds
Defensive patterns

Strategy: retry

Validate before calling

// verify metadata engine reachability before repairing
if err := m.en.doLoadQuotas(ctx); err != nil {
    return fmt.Errorf("metadata engine unavailable; postpone repair: %w", err)
}

Try / catch

for attempt := 0; attempt < 3; attempt++ {
    err := repairUgUsage(ctx, qtype, usageMap, quotaMap)
    if err == nil || !errors.Is(err, context.DeadlineExceeded) { return err }
    time.Sleep(backoff(attempt))
}

Prevention

When it happens

Trigger: `juicefs quota check --repair` (user/group quota path via checkUGUsage -> repairUgUsage) where the engine's cleanUgUsage returns an error — e.g. Redis/SQL/KV backend unavailable, transaction failure, or permission problem while deleting usage records.

Common situations: Metadata engine temporarily down or network-partitioned during repair; backend auth/ACL denies the delete; large numbers of uid/gid records causing timeouts in SQL engines.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/26eb4aee1e421061. Report an issue: GitHub.