Skip to content

Degrade gracefully if mmap is not allowed on this file system #4019

Open

Description

@Keno

libgit2 returns an error when it cannot mmap a file. Certain file systems, e.g. network file systems, disallow mmap (or at least MAP_SHARED). It would be nice if libgit2 degraded gracefully.

Reproduction steps

Try to use a libgit2-based project on a network file system. In my case, this was DataWarp/GPFS, but I suspect the same is true for others as well. Example strace log:

open("/global/u1/k/kfischer/.julia/v0.6/tmpD5GGuN/METADATA/.git/objects/pack/pack_git2_t122RZ", O_RDWR|O_CREAT|O_EXCL, 0600) = 22
[snip]
mmap(NULL, 11, PROT_READ|PROT_WRITE, MAP_SHARED, 22, 0) = -1 ENOSYS (Function not implemented)

Expected behavior

If the mmap fails, fall back to some other method (e.g. flock with explicit reads/writes).

Actual behavior

Surfaces the error to the application.

Version of libgit2 (release number or SHA1)

4cf1ec7

Operating system(s) tested

Cray Linux

Activity

  1. amm1111 commented on Dec 21, 2016

    @amm1111

    2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions