Skip to content
Snippets Groups Projects
  1. Jan 22, 2014
  2. Jan 21, 2014
    • Nadav Har'El's avatar
      chdir(): Fix error path, and add test · 4ae8779e
      Nadav Har'El authored
      
      This patch fixes chdir() on a normal file, which used to succeed (!?),
      but now will fail as it should, with ENOTDIR.
      
      The patch also adds an exhaustive test for chdir's success and error cases.
      Before the latest chdir() patches, most of these tests would fail, and now
      all of them succeed.
      
      This test is standard C++ & Posix code, so it can be run also on Linux.
      This is important for verifing that whatever we expect from OSv, Linux
      really does the same.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      4ae8779e
    • Nadav Har'El's avatar
      open(): add O_DIRECTORY flag · 05fc5774
      Nadav Har'El authored
      
      This patch adds the O_DIRECTORY flag to sys_open(), which causes the open
      to fail with ENOTDIR if the given file is any type of file but a directory.
      
      We need this flag as part of a correct implementation of chdir() (which
      should fail on a non-directory file), and it is also required for Linux
      compatibility (the O_DIRECTORY flag exists since Linux 2.1.126).
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      05fc5774
    • Nadav Har'El's avatar
      Fix non-functional chdir() · 0f9bf9b6
      Nadav Har'El authored
      
      I don't know how chdir() ever worked - apparently it didn't!
      
      It took an argument "pathname", and then declared a local "path" and used
      that, not pathname, as the path :-) Obviously, a call to task_conv, which
      converts a relative "pathname" to an absolute "path", was missing...
      
      chdir() is still a mess and incompatible in the error cases with Linux's
      chdir(). I'll fix that, and add a test, in a follow-up patch.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      0f9bf9b6
  3. Jan 17, 2014
  4. Jan 16, 2014
  5. Jan 09, 2014
    • Raphael S. Carvalho's avatar
      zfs: Fix on-disk data inconsistency on shutdown · 2d93af3b
      Raphael S. Carvalho authored
      
      This problem was found when running 'tests/tst-zfs-mount.so' multiple times.
      At the first time, all tests succeed, however, a subsequent run would
      fail at the test: 'mkdir /foo/bar', the error message reported
      that the target file already exists.
      
      The test basically creates a directory /foo/bar, rename it to /foo/bar2,
      then remove /foo/bar2. How could /foo/bar still be there?
      
      Quite simple. Our shutdown function calls unmount_rootfs() which will
      attempt to unmount zfs with the flag MNT_FOURCE, however, it's not being
      passed to zfs_unmount(), neither unmount_rootfs() tests itself the
      return status (which was always getting failures previously).
      So OSv is really being shutdown while there is remaining data waiting to
      be synced with the backing store. As a result, inconsitency.
      
      This problem was fixed by passing the flag to VFS_UNMOUNT which will now
      unmount the fs properly on sudden shutdowns.
      
      Signed-off-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      2d93af3b
  6. Jan 03, 2014
  7. Jan 01, 2014
    • Nadav Har'El's avatar
      fs: clean up old "fo_*" C functions · a844d248
      Nadav Har'El authored
      
      Instead of the old C-style file-operation function types and fo_*()
      functions, since recently we have methods of the "file" class. All our
      filesystem code is now C++, and can use these methods directly.
      
      So this patch drops the old types and functions, and uses the class methods
      instead.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      a844d248
    • Nadav Har'El's avatar
      file: reduce boiler-plate code in special files · 9478a14d
      Nadav Har'El authored
      
      Each implementation of "struct file" needs to implement 8 different file
      operations. Most special file implementations, such as pipe, socketpair,
      epoll and timerfd, don't support many of these operations. We had in
      unsupported.h functions that can be reused for the unsupported operation,
      but this resulted in a lot of ugly boiler-plate code.
      
      Instead, this patch switches to a cleaner, more C++-like, method:
      It defines a new "file" subclass, called "special_file", which implements
      all file operations except close(), with a default implementation identical
      to the old unsupported.h implementations.
      
      The files of pipe(), socketpair(), timerfd() and epoll_create() now inherit
      from special_file, and only override the file operations they really want
      to implement.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      9478a14d
  8. Dec 19, 2013
  9. Dec 16, 2013
  10. Dec 13, 2013
  11. Dec 10, 2013
    • Raphael S. Carvalho's avatar
      vfs: Fix duplicate in-memory vnodes · 9ecda822
      Raphael S. Carvalho authored
      
      Currently, namei() does vget() unconditionally if no dentry is found.
      This is wrong because the path can be a hard link that points to a vnode
      that's already in memory.
      
      To fix the problem:
      
        - Use inode number as part of the hash in vget()
      
        - Use vn_lookup() in vget() to make sure we have one vnode in memory
          per inode number.
      
        - Push the vget() calls down to individual filesystems and make
          VOP_LOOKUP return an vnode
      
      Changes since v2:
        - v1 dropped lock in vn_lookup, thus assert that vnode_lock is held.
      
      Changes since v3:
        - Fix lock ordering issue in dentry_lookup. The lock respective to the parent
      node must be acquired before dentry_lookup and released after the process is
      done. Otherwise, a second thread looking up for the same dentry may take the
      'NULL' path incorrectly.
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      Signed-off-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      9ecda822
    • Nadav Har'El's avatar
      Fix wrong error codes in unlink(), rmdir() and readdir() · 86b5374f
      Nadav Har'El authored
      
      This patch fixes the error codes in four error cases:
      
      1. unlink() of a directory used to return EPERM (as in Posix), and now
         returns EISDIR (as in Linux).
      
      2. rmdir() of a non-empty directory used to return EEXIST (as in Posix)
         and now returns ENOTEMPTY (as in Linux).
      
      3. rmdir() of a regular file (non-directory) used to return EBADF
         and now returns ENOTDIR (as in Linux).
      
      4. readdir() of a regular file (non-directory) used to return EBADF
         and now returns ENOTDIR (as in Linux).
      
      This patch also adds a test, tst-remove.cc, for the various unlink() and
      rmdir() success and failure modes.
      
      Fixes #123.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      86b5374f
  12. Dec 09, 2013
  13. Dec 08, 2013
  14. Dec 04, 2013
  15. Dec 03, 2013
Loading