NVSL / linux-nova

NOVA is a log-structured file system designed for byte-addressable non-volatile memories, developed at the University of California, San Diego.
http://nvsl.ucsd.edu/index.php?path=projects/nova
Other
422 stars 117 forks source link

Issue with fallocate after remount #134

Closed hayley-leblanc closed 2 years ago

hayley-leblanc commented 2 years ago

Hi Andiry,

I've come across a bug that manifests in a similar way to #132. I'm running a program that creates a file, calls fallocate() on it with one file descriptor, then opens two new file descriptors and writes to it with one of them. Interestingly it seems that the file needs to open 3 file descriptors in order to trigger the bug. Here's a program that should reproduce it: test8.zip

Here are the steps to reproduce (note that this bug does not require a crash to reproduce:

  1. Mount NOVA with mount -t NOVA -o init /dev/pmem0 /mnt/pmem
  2. Run the attached program. If you run cat /mnt/pmem/file0, it should print out a bunch of 'a's. stat /mnt/pmem/file0 should output the following:
    File: /mnt/pmem/file0
    Size: 227         Blocks: 8          IO Block: 4096   regular file
    Device: 10301h/66305d   Inode: 33          Links: 1
    Access: (0000/----------)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2021-12-09 00:01:26.000000000 +0000
    Modify: 2021-12-09 00:01:26.000000000 +0000
    Change: 2021-12-09 00:01:26.000000000 +0000
    Birth: -
  3. Unmount and remount NOVA
  4. Now stat and cat file0. stat /mnt/pmem/file0 will give the same output, but cat will output nothing, i.e., the file's contents are gone/zeroed out.

Let me know if you are able to reproduce it. Thanks!

Andiry commented 2 years ago

Yes I can reproduce. Let me take a look. Thanks for reporting.

Andiry commented 2 years ago

Fixed.