1. 02 6月, 2015 5 次提交
    • J
      f2fs crypto: avoid f2fs_inherit_context for symlink · e992e238
      Jaegeuk Kim 提交于
      This patch fixes to call f2fs_inherit_context twice for newly created symlink.
      The original one is called by f2fs_add_link(), which invokes f2fs_setxattr.
      If the second one is called again, f2fs_setxattr is triggered again with same
      encryption index.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      e992e238
    • C
      f2fs crypto: check context consistent for rename2 · d3baf7c4
      Chao Yu 提交于
      For exchange rename, we should check context consistent of encryption
      between new_dir and old_inode or old_dir and new_inode. Otherwise
      inheritance of parent's encryption context will be broken.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      [Jaegeuk Kim: sync with ext4 approach]
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      d3baf7c4
    • J
      f2fs crypto: use per-inode tfm structure · 26bf3dc7
      Jaegeuk Kim 提交于
      This patch applies the following ext4 patch:
      
        ext4 crypto: use per-inode tfm structure
      
      As suggested by Herbert Xu, we shouldn't allocate a new tfm each time
      we read or write a page.  Instead we can use a single tfm hanging off
      the inode's crypt_info structure for all of our encryption needs for
      that inode, since the tfm can be used by multiple crypto requests in
      parallel.
      
      Also use cmpxchg() to avoid races that could result in crypt_info
      structure getting doubly allocated or doubly freed.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      26bf3dc7
    • J
      f2fs crypto: check encryption for tmpfile · 304eecc3
      Jaegeuk Kim 提交于
      This patch adds to check encryption for tmpfile in early stage.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      304eecc3
    • C
      f2fs: support RENAME_WHITEOUT · 7e01e7ad
      Chao Yu 提交于
      As the description of rename in manual, RENAME_WHITEOUT is a special operation
      that only makes sense for overlay/union type filesystem.
      
      When performing rename with RENAME_WHITEOUT, dst will be replace with src, and
      meanwhile, a 'whiteout' will be create with name of src.
      
      A "whiteout" is designed to be a char device with 0,0 device number, it has
      specially meaning for stackable filesystem. In these filesystems, there are
      multiple layers exist, and only top of these can be modified. So a whiteout
      in top layer is used to hide a corresponding file in lower layer, as well
      removal of whiteout will make the file appear.
      
      Now in overlayfs, when we rename a file which is exist in lower layer, it
      will be copied up to upper if it is not on upper layer yet, and then rename
      it on upper layer, source file will be whiteouted to hide corresponding file
      in lower layer at the same time.
      
      So in upper layer filesystem, implementation of RENAME_WHITEOUT provide a
      atomic operation for stackable filesystem to support rename operation.
      
      There are multiple ways to implement RENAME_WHITEOUT in log of this commit:
      7dcf5c3e ("xfs: add RENAME_WHITEOUT support") which pointed out by
      Dave Chinner.
      
      For now, we just try to follow the way that xfs/ext4 use.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      7e01e7ad
  2. 29 5月, 2015 7 次提交
  3. 11 5月, 2015 3 次提交
    • A
      switch ->put_link() from dentry to inode · 5f2c4179
      Al Viro 提交于
      only one instance looks at that argument at all; that sole
      exception wants inode rather than dentry.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5f2c4179
    • A
      don't pass nameidata to ->follow_link() · 6e77137b
      Al Viro 提交于
      its only use is getting passed to nd_jump_link(), which can obtain
      it from current->nameidata
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      6e77137b
    • A
      new ->follow_link() and ->put_link() calling conventions · 680baacb
      Al Viro 提交于
      a) instead of storing the symlink body (via nd_set_link()) and returning
      an opaque pointer later passed to ->put_link(), ->follow_link() _stores_
      that opaque pointer (into void * passed by address by caller) and returns
      the symlink body.  Returning ERR_PTR() on error, NULL on jump (procfs magic
      symlinks) and pointer to symlink body for normal symlinks.  Stored pointer
      is ignored in all cases except the last one.
      
      Storing NULL for opaque pointer (or not storing it at all) means no call
      of ->put_link().
      
      b) the body used to be passed to ->put_link() implicitly (via nameidata).
      Now only the opaque pointer is.  In the cases when we used the symlink body
      to free stuff, ->follow_link() now should store it as opaque pointer in addition
      to returning it.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      680baacb
  4. 05 5月, 2015 1 次提交
  5. 17 4月, 2015 2 次提交
  6. 16 4月, 2015 1 次提交
  7. 11 4月, 2015 1 次提交
    • J
      f2fs: add F2FS_INLINE_DOTS to recover missing dot dentries · 510022a8
      Jaegeuk Kim 提交于
      If f2fs was corrupted with missing dot dentries, it needs to recover them after
      fsck.f2fs detection.
      
      The underlying precedure is:
      
      1. The fsck.f2fs remains F2FS_INLINE_DOTS flag in directory inode, if it detects
      missing dot dentries.
      
      2. When f2fs looks up the corrupted directory, it triggers f2fs_add_link with
      proper inode numbers and their dot and dotdot names.
      
      3. Once f2fs recovers the directory without errors, it removes F2FS_INLINE_DOTS
      finally.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      510022a8
  8. 04 3月, 2015 1 次提交
  9. 12 2月, 2015 1 次提交
  10. 24 11月, 2014 1 次提交
  11. 10 11月, 2014 1 次提交
  12. 05 11月, 2014 1 次提交
    • J
      f2fs: revisit inline_data to avoid data races and potential bugs · b3d208f9
      Jaegeuk Kim 提交于
      This patch simplifies the inline_data usage with the following rule.
      1. inline_data is set during the file creation.
      2. If new data is requested to be written ranges out of inline_data,
       f2fs converts that inode permanently.
      3. There is no cases which converts non-inline_data inode to inline_data.
      4. The inline_data flag should be changed under inode page lock.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b3d208f9
  13. 04 11月, 2014 4 次提交
  14. 01 10月, 2014 1 次提交
  15. 04 9月, 2014 1 次提交
  16. 02 9月, 2014 1 次提交
    • C
      f2fs: reposition unlock_new_inode to prevent accessing invalid inode · b73e5282
      Chao Yu 提交于
      As the race condition on the inode cache, following scenario can appear:
      [Thread a]				[Thread b]
      					->f2fs_mkdir
      					  ->f2fs_add_link
      					    ->__f2fs_add_link
      					      ->init_inode_metadata failed here
      ->gc_thread_func
        ->f2fs_gc
          ->do_garbage_collect
            ->gc_data_segment
              ->f2fs_iget
                ->iget_locked
                  ->wait_on_inode
      					  ->unlock_new_inode
              ->move_data_page
      					  ->make_bad_inode
      					  ->iput
      
      When we fail in create/symlink/mkdir/mknod/tmpfile, the new allocated inode
      should be set as bad to avoid being accessed by other thread. But in above
      scenario, it allows f2fs to access the invalid inode before this inode was set
      as bad.
      This patch fix the potential problem, and this issue was found by code review.
      
      change log from v1:
       o Add condition judgment in gc_data_segment() suggested by Changman Lee.
       o use iget_failed to simplify code.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b73e5282
  17. 22 8月, 2014 1 次提交
  18. 20 8月, 2014 1 次提交
  19. 25 7月, 2014 1 次提交
  20. 10 7月, 2014 4 次提交
  21. 09 7月, 2014 1 次提交
    • J
      f2fs: do checkpoint for the renamed inode · b2c08299
      Jaegeuk Kim 提交于
      If an inode is renamed, it should be registered as file_lost_pino to conduct
      checkpoint at f2fs_sync_file.
      Otherwise, the inode cannot be recovered due to no dent_mark in the following
      scenario.
      
      Note that, this scenario is from xfstests/322.
      
      1. create "a"
      2. fsync "a"
      3. rename "a" to "b"
      4. fsync "b"
      5. Sudden power-cut
      
      After recovery is done, "b" should be seen.
      However, the result shows "a", since the recovery procedure does not enter
      recover_dentry due to no dent_mark.
      
      The reason is like below.
      - The nid of "a" is checkpointed during #2, f2fs_sync_file.
      - The inode page for "b" produced by #3 is written without dent_mark by
      sync_node_pages.
      
      So, this patch fixes this bug by assinging file_lost_pino to the "a"'s inode.
      If the pino is lost, f2fs_sync_file conducts checkpoint, and then recovers
      the latest pino and its dentry information for further recovery.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b2c08299