Skip to content

Overlay 20-bit page offset caps writable files; reported as -ENOSPC instead of -EFBIG #22

Description

@congwang-mk

Overlay data keys pack the page offset into 20 bits (include/daxfs_format.h:168):

#define DAXFS_OVL_MAX_PGOFF  0xFFFFDULL

so a writable file is capped at 0xFFFFE << PAGE_SHIFT, about 4 GiB with 4 KiB pages and 64 GiB with 64 KiB pages. daxfs_overlay_alloc_page() and friends (daxfs/overlay.c:538, :565, :639) enforce it by returning NULL, which daxfs_write_iter() turns into:

return total ? total : -ENOSPC;

Two problems:

  1. Wrong errno. The filesystem is not out of space, the file hit its maximum size. That is -EFBIG, and it should raise SIGXFSZ the way generic_write_check_limits() does. -ENOSPC sends anyone debugging it to look at pool capacity, which is fine.
  2. Undocumented. The limit is not in the README and there is no way to discover it short of hitting it. s_maxbytes is MAX_LFS_FILESIZE (daxfs: Fix superblock and inode geometry reported to the VFS #14), deliberately, because a read-only base image has no such cap and the model weight files daxfs targets are routinely larger. So the VFS will not catch it either.

Worth noting the limit is page-size dependent, which makes it awkward for a filesystem shared between hosts with different page sizes.

Suggested: return -EFBIG from the overlay write paths, and document the ceiling in the README next to the mkdaxfs options.

Found during the review in #14.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions