Code Monkey home page Code Monkey logo

omsaran / splitfs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from utsaslab/splitfs

0.0 0.0 0.0 204.75 MB

SplitFS: persistent-memory file system that reduces software overhead (SOSP 2019)

Home Page: https://www.cs.utexas.edu/~vijay/papers/sosp19-splitfs.pdf

License: Other

Makefile 0.28% C 95.68% C++ 1.41% Objective-C 0.54% Shell 0.22% Perl 0.13% Python 0.07% Roff 0.01% M4 0.03% CMake 0.01% HTML 0.01% TeX 0.01% Batchfile 0.01% TSQL 0.01% Java 0.15% Lua 0.01% Assembly 1.45% Awk 0.01% GDB 0.01% sed 0.01%

splitfs's People

Contributors

dependabot[bot] avatar om-saran avatar omsaran avatar rohankadekodi avatar vijay03 avatar wraymo avatar

Watchers

 avatar

splitfs's Issues

Appending to a file greater than DR_SIZE fails.

Lets say the DR_SIZE is 512MB.
If we try to append to a file that is lets say 512MB then the write fails.

This is because of the following

  1. The append goes to the staging file (which is of size 512MB (DR_SIZE))
  2. The corresponding offset in the staging file is the same as the original requested offset
  3. In this case the offset is going to be - 512 * 1024 * 1024
  4. Writing to a size beyond the offset fails due to assertion

Relevant pointers to the code:

  1. The staging file memory mapped address to write to: https://github.com/utsaslab/SplitFS/blob/master/splitfs/fileops_nvp.c#L2859
  2. The assertion that crashes SplitFS: https://github.com/utsaslab/SplitFS/blob/master/splitfs/fileops_nvp.c#L130

Unclosed files are not handled properly

Consider an application that does the following in order

  1. Create a file.
  2. Append to the file.
  3. Exit the application without explicitly performing a close

In the above scenario the appends are not getting relinked.

Snippet to reproduce the issue:

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <sys/wait.h>

#define FILE_PATH "/mnt/pmem_emul/test.txt"

int main() {
  int fd, result;
  char buf[] = "Hello world!\n";
  fd = open(FILE_PATH, O_CREAT | O_RDWR);

  result = write(fd, buf, strlen(buf));
  assert(result>=0);

  sync();

  //close(fd);
}

Overwriting a file without fsync

This scenario fails

  1. Append to a file.
  2. Using lsleek and write try to overwrite the appended contents without doing an fsync/close

Code snippet to reproduce the issue.

#include <stdio.h>
#include <fcntl.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>

#define FILE_PATH "/mnt/pmem_emul/test.txt"

int main() {

  // Create the file
  int fd = open(FILE_PATH, O_CREAT | O_RDWR);
  char buf[] = "Hello";

  // Write something onto it
  int ret = write(fd, buf, strlen(buf));
  assert(fd>=0);
  assert(ret>=0);

  // Open it again
  lseek(fd, 0, SEEK_SET);

  // Write a few byes
  char buf2[] = "wor";
  ret = write(fd, buf2, strlen(buf2));
  assert(ret>=0);

  close(fd);
}

A single write that requires overwrite and append fails.

This sequence of operations results in incorrect behaviour.
It does the overwrite but fails to append

  1. Open a file that is of size say 5 (say Hello is the content)
  2. Seek to an offset less than 5 - say 3
  3. Write a string that is larger than 2. (say World)

The result in the file is then - HelWo instead of HelWorld

Code snippet to reproduce the issue:

#include <stdio.h>
#include <fcntl.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>

#define FILE_PATH "/mnt/pmem_emul/test.txt"

int main() {

  // Create the file
  int fd = open(FILE_PATH, O_CREAT | O_RDWR);
  char buf[] = "Hello";

  // Write something onto it
  int ret = write(fd, buf, strlen(buf));
  assert(fd>=0);
  assert(ret>=0);

  close(fd);

  fd = open(FILE_PATH, O_RDWR);
  assert(fd>=0);

  // Seek to a valid offset within the file size.
  lseek(fd, 3, SEEK_SET);

  // Write a few byes
  char buf2[] = "world";
  ret = write(fd, buf2, strlen(buf2));
  assert(ret>=0);

  close(fd);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.