1. 08 7月, 2017 1 次提交
    • S
      f2fs: do not set LOST_PINO for renamed dir · b855bf0e
      Sheng Yong 提交于
      After renaming a directory, fsck could detect unmatched pino. The scenario
      can be reproduced as the following:
      
      	$ mkdir /bar/subbar /foo
      	$ rename /bar/subbar /foo
      
      Then fsck will report:
      [ASSERT] (__chk_dots_dentries:1182)  --> Bad inode number[0x3] for '..', parent parent ino is [0x4]
      
      Rename sets LOST_PINO for old_inode. However, the flag cannot be cleared,
      since dir is written back with CP. So, let's get rid of LOST_PINO for a
      renamed dir and fix the pino directly at the end of rename.
      Signed-off-by: NSheng Yong <shengyong1@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b855bf0e
  2. 04 5月, 2017 1 次提交
  3. 13 4月, 2017 1 次提交
    • J
      f2fs: fix fs corruption due to zero inode page · 9bb02c36
      Jaegeuk Kim 提交于
      This patch fixes the following scenario.
      
      - f2fs_create/f2fs_mkdir             - write_checkpoint
       - f2fs_mark_inode_dirty_sync         - block_operations
                                             - f2fs_lock_all
                                             - f2fs_sync_inode_meta
                                              - f2fs_unlock_all
                                              - sync_inode_metadata
       - f2fs_lock_op
                                               - f2fs_write_inode
                                                - update_inode_page
                                                 - get_node_page
                                                   return -ENOENT
       - new_inode_page
        - fill_node_footer
       - f2fs_mark_inode_dirty_sync
       - ...
       - f2fs_unlock_op
                                                - f2fs_inode_synced
                                             - f2fs_lock_all
                                             - do_checkpoint
      
      In this checkpoint, we can get an inode page which contains zeros having valid
      node footer only.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      9bb02c36
  4. 22 3月, 2017 2 次提交
  5. 29 1月, 2017 2 次提交
  6. 01 1月, 2017 1 次提交
    • E
      fscrypt: use ENOKEY when file cannot be created w/o key · 54475f53
      Eric Biggers 提交于
      As part of an effort to clean up fscrypt-related error codes, make
      attempting to create a file in an encrypted directory that hasn't been
      "unlocked" fail with ENOKEY.  Previously, several error codes were used
      for this case, including ENOENT, EACCES, and EPERM, and they were not
      consistent between and within filesystems.  ENOKEY is a better choice
      because it expresses that the failure is due to lacking the encryption
      key.  It also matches the error code returned when trying to open an
      encrypted regular file without the key.
      
      I am not aware of any users who might be relying on the previous
      inconsistent error codes, which were never documented anywhere.
      
      This failure case will be exercised by an xfstest.
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      54475f53
  7. 09 12月, 2016 1 次提交
  8. 24 11月, 2016 1 次提交
  9. 08 10月, 2016 1 次提交
  10. 01 10月, 2016 1 次提交
  11. 28 9月, 2016 1 次提交
  12. 27 9月, 2016 1 次提交
  13. 16 9月, 2016 1 次提交
    • E
      fscrypto: make filename crypto functions return 0 on success · ef1eb3aa
      Eric Biggers 提交于
      Several filename crypto functions: fname_decrypt(),
      fscrypt_fname_disk_to_usr(), and fscrypt_fname_usr_to_disk(), returned
      the output length on success or -errno on failure.  However, the output
      length was redundant with the value written to 'oname->len'.  It is also
      potentially error-prone to make callers have to check for '< 0' instead
      of '!= 0'.
      
      Therefore, make these functions return 0 instead of a length, and make
      the callers who cared about the return value being a length use
      'oname->len' instead.  For consistency also make other callers check for
      a nonzero result rather than a negative result.
      
      This change also fixes the inconsistency of fname_encrypt() actually
      already returning 0 on success, not a length like the other filename
      crypto functions and as documented in its function comment.
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: NAndreas Dilger <adilger@dilger.ca>
      Acked-by: NJaegeuk Kim <jaegeuk@kernel.org>
      ef1eb3aa
  14. 08 9月, 2016 1 次提交
  15. 21 7月, 2016 1 次提交
  16. 09 7月, 2016 1 次提交
  17. 07 7月, 2016 2 次提交
  18. 03 6月, 2016 6 次提交
  19. 11 4月, 2016 1 次提交
  20. 05 4月, 2016 1 次提交
    • K
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov 提交于
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  21. 31 3月, 2016 1 次提交
  22. 18 3月, 2016 3 次提交
  23. 03 3月, 2016 1 次提交
  24. 23 2月, 2016 3 次提交
    • C
      f2fs: fix to delete old dirent in converted inline directory in ->rename · 993a0499
      Chao Yu 提交于
      When doing test with fstests/generic/068 in inline_dentry enabled f2fs,
      following oops dmesg will be reported:
      
       ------------[ cut here ]------------
       WARNING: CPU: 5 PID: 11841 at fs/inode.c:273 drop_nlink+0x49/0x50()
       Modules linked in: f2fs(O) ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state
       CPU: 5 PID: 11841 Comm: fsstress Tainted: G           O    4.5.0-rc1 #45
       Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.61 05/16/2013
        0000000000000111 ffff88009cdf7ae8 ffffffff813e5944 0000000000002e41
        0000000000000000 0000000000000111 0000000000000000 ffff88009cdf7b28
        ffffffff8106a587 ffff88009cdf7b58 ffff8804078fe180 ffff880374a64e00
       Call Trace:
        [<ffffffff813e5944>] dump_stack+0x48/0x64
        [<ffffffff8106a587>] warn_slowpath_common+0x97/0xe0
        [<ffffffff8106a5ea>] warn_slowpath_null+0x1a/0x20
        [<ffffffff81231039>] drop_nlink+0x49/0x50
        [<ffffffffa07b95b4>] f2fs_rename2+0xe04/0x10c0 [f2fs]
        [<ffffffff81231ff1>] ? lock_two_nondirectories+0x81/0x90
        [<ffffffff813f454d>] ? lockref_get+0x1d/0x30
        [<ffffffff81220f70>] vfs_rename+0x2e0/0x640
        [<ffffffff8121f9db>] ? lookup_dcache+0x3b/0xd0
        [<ffffffff810b8e41>] ? update_fast_ctr+0x21/0x40
        [<ffffffff8134ff12>] ? security_path_rename+0xa2/0xd0
        [<ffffffff81224af6>] SYSC_renameat2+0x4b6/0x540
        [<ffffffff810ba8ed>] ? trace_hardirqs_off+0xd/0x10
        [<ffffffff810022ba>] ? exit_to_usermode_loop+0x7a/0xd0
        [<ffffffff817e0ade>] ? int_ret_from_sys_call+0x52/0x9f
        [<ffffffff810bdc90>] ? trace_hardirqs_on_caller+0x100/0x1c0
        [<ffffffff81224b8e>] SyS_renameat2+0xe/0x10
        [<ffffffff8121f08e>] SyS_rename+0x1e/0x20
        [<ffffffff817e0957>] entry_SYSCALL_64_fastpath+0x12/0x6f
       ---[ end trace 2b31e17995404e42 ]---
      
      This is because: in the same inline directory, when we renaming one file
      from source name to target name which is not existed, once space of inline
      dentry is not enough, inline conversion will be triggered, after that all
      data in inline dentry will be moved to normal dentry page.
      
      After attaching the new entry in coverted dentry page, still we try to
      remove old entry in original inline dentry, since old entry has been
      moved, so it obviously doesn't make any effect, result in remaining old
      entry in converted dentry page.
      
      Now, we have two valid dentries pointed to the same inode which has nlink
      value of 1, deleting them both, above warning appears.
      
      This issue can be reproduced easily as below steps:
      1. mount f2fs with inline_dentry option
      2. mkdir dir
      3. touch 180 files named [001-180] in dir
      4. rename dir/180 dir/181
      5. rm dir/180 dir/181
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      993a0499
    • C
      f2fs: detect error of update_dent_inode in ->rename · 9def1e92
      Chao Yu 提交于
      Should check and show correct return value of update_dent_inode in
      ->rename.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      9def1e92
    • C
      f2fs crypto: avoid unneeded memory allocation when {en/de}crypting symlink · 922ec355
      Chao Yu 提交于
      This patch adopts f2fs with codes of ext4, it removes unneeded memory
      allocation in creating/accessing path of symlink.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      922ec355
  25. 09 1月, 2016 1 次提交
  26. 01 1月, 2016 1 次提交
  27. 31 12月, 2015 2 次提交