Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create a new lusf file on tmpfs(Linux) #10

Open
shinnya opened this issue Nov 9, 2018 · 1 comment
Open

Can't create a new lusf file on tmpfs(Linux) #10

shinnya opened this issue Nov 9, 2018 · 1 comment
Assignees

Comments

@shinnya
Copy link
Contributor

shinnya commented Nov 9, 2018

It may be impossible to create a new lusf file on tmpfs because tmpfs doesn't support O_DIRECT. This issue makes cannyls(or frugalos) crash.

I checked the behavior of tmpfs by the following code:

#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <errno.h> // errno
#include <string.h> // strerror

int main(int argc, char** argv)
{
    int result = open("/tmp/foo.txt", O_CREAT | O_RDONLY | O_DIRECT);

    if (result == -1) {
        printf("%s\n", strerror(errno));
        return -1;
    }

    printf("ok\n");

    return 0;
}

Then run:

$ gcc -o main main.c ; ./main
Invalid argument

environment

$ uname -a
Linux quad 4.18.6-arch1-1-ARCH #1 SMP PREEMPT Wed Sep 5 11:54:09 UTC 2018 x86_64 GNU/Linux

$ cargo -V
cargo 1.30.0 (a1a4ad372 2018-11-02)

how to reproduce

Make sure that /tmp is mounted as tmpfs.

$ git clone https://github.com/frugalos/kanils.git
$ cd kanils
$ cargo run -- Create --storage /tmp/foo.lusf --capacity=1024
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/kanils Create --storage /tmp/foo.lusf --capacity=1024`
passed data region size = 1024
thread 'main' panicked at '
EXPRESSION: FileNvm::create(opt.storage_path, total_size)
ERROR: Other (cause; File exists (os error 17))
HISTORY:
  [0] at /home/shinnya/.cargo/registry/src/github.com-1ecc6299db9ec823/cannyls-0.9.1/src/nvm/file.rs:163
  [1] at src/main.rs:212
@shinnya shinnya self-assigned this Nov 9, 2018
@yuezato
Copy link
Member

yuezato commented Nov 9, 2018

I think this is a problem of KaNiLs rather than CannyLS:
https://github.com/frugalos/kanils/blob/3fffa9a5641f4f5153f174264e3f88e35ad60ffe/src/main.rs#L212-L217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants