juicedata/juicefs · error

create %s: %s

Error message

create %s: %s

What it means

Wraps the syscall.Errno returned by jfs.Create() when the mdtest benchmark tries to create file.mdtest.<thread>.<i> inside a test directory. Any metadata-engine create failure (EACCES, ENOENT for a missing parent, ENOSPC/quota, or backend outage) surfaces as `create <path>: <errno>`. The parent directory is expected to exist from the earlier createDir phase, so failures are usually permission or backend errors.

Source

Thrown at cmd/mdtest.go:71

	}
	if d > 0 {
		for i := 0; i < width; i++ {
			dn := path.Join(root, fmt.Sprintf("mdtest_tree.%d", i))
			if err := createDir(jfs, dn, d-1, width); err != nil {
				return err
			}
		}
	}
	return nil
}

func createFile(jfs *fs.FileSystem, bar *utils.Bar, np int, root string, d int, width, files, bytes int) error {
	m := jfs.Meta()
	for i := 0; i < files; i++ {
		fn := path.Join(root, fmt.Sprintf("file.mdtest.%d.%d", np, i))
		f, err := jfs.Create(ctx, fn, 0666, umask)
		if err != 0 {
			return fmt.Errorf("create %s: %s", fn, err)
		}
		if bytes > 0 {
			for indx := 0; indx*meta.ChunkSize < bytes; indx++ {
				var id uint64
				if st := m.NewSlice(ctx, &id); st != 0 {
					return fmt.Errorf("writechunk %s: %s", fn, st)
				}
				size := meta.ChunkSize
				if bytes < (indx+1)*meta.ChunkSize {
					size = bytes - indx*meta.ChunkSize
				}
				if st := m.Write(ctx, f.Inode(), uint32(indx), 0, meta.Slice{Id: id, Size: uint32(size), Len: uint32(size)}, time.Now()); st != 0 {
					return fmt.Errorf("writeend %s: %s", fn, st)
				}
			}
		}
		f.Close(ctx)
		bar.Increment()

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Re-run mdtest on a clean PATH so createDir has definitely created all parent dirs before createFile starts
  2. Confirm the client's uid/gid has write permission on the test directories (check ctx uid setup vs volume root owner)
  3. Verify the metadata backend is healthy and has space (`juicefs status`, backend logs); fix connectivity or free capacity
  4. Avoid running two mdtest instances against the same META-URL/PATH simultaneously
  5. If using --subdir, ensure it points to an existing writable directory

Example fix

// before
$ juicefs mdtest --threads 8 redis://localhost /shared   # workers race, create fails
// after
$ juicefs mdtest --threads 8 redis://localhost /run1-$RANDOM
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure parent dirs were created and are writable before createFile phase
if st := jfs.Stat(ctx, root); st != 0 {
    return fmt.Errorf("test dir %s missing before file phase", root)
}

Try / catch

// the error is returned up the stack; catch at the runTest boundary
if err := createFile(jfs, bar, np, root, depth, width, files, bytes); err != nil {
    if errors.Is(err, syscall.EACCES) || errors.Is(err, syscall.ENOSPC) {
        logger.Errorf("Create: %s (check permissions/quota)", err)
        return
    }
    logger.Errorf("Create: %s", err)
}

Prevention

When it happens

Trigger: `juicefs mdtest` with -threads N where worker np creates files under a test dir that was deleted/moved concurrently; parent directory permissions reject the client's uid; metadata engine write failure (connection dropped, quota exceeded, ENOSPC on SQLite); running read-only against the volume.

Common situations: Concurrent mdtest runs sharing the same PATH so workers race on the same tree; volume root owned by another user; disk full on the metadata backend (e.g. SQLite file on a full disk); transient Redis connection loss under load.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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