1. 05 Oct, 2018 1 commit
  2. 12 May, 2018 1 commit
  3. 06 Apr, 2018 2 commits
  4. 07 Sep, 2017 1 commit
  5. 23 Dec, 2016 1 commit
  6. 13 Dec, 2016 1 commit
    • Ashish Samant's avatar
      ocfs2: fix double put of recount tree in ocfs2_lock_refcount_tree() · 4131d538
      Ashish Samant authored
      In ocfs2_lock_refcount_tree, if ocfs2_read_refcount_block() returns an
      error, we do ocfs2_refcount_tree_put twice (once in
      ocfs2_unlock_refcount_tree and once outside it), thereby reducing the
      refcount of the refcount tree twice, but we dont delete the tree in this
      case.  This will make refcnt of the tree = 0 and the
      ocfs2_refcount_tree_put will eventually call ocfs2_mark_lockres_freeing,
      setting OCFS2_LOCK_FREEING for the refcount_tree->rf_lockres.
      
      The error returned by ocfs2_read_refcount_block is propagated all the
      way back and for next iteration of write, ocfs2_lock_refcount_tree gets
      the same tree back from ocfs2_get_refcount_tree because we havent
      deleted the tree.  Now we have the same tree, but OCFS2_LOCK_FREEING is
      set for rf_lockres and eventually, when _ocfs2_lock_refcount_tree is
      called in this iteration, BUG_ON( __ocfs2_cluster_lock:1395 ERROR:
      Cluster lock called on freeing lockres T00000000000000000386019775b08d!
      flags 0x81) is triggerred.
      
      Call stack:
      
        (loop16,11155,0):ocfs2_lock_refcount_tree:482 ERROR: status = -5
        (loop16,11155,0):ocfs2_refcount_cow_hunk:3497 ERROR: status = -5
        (loop16,11155,0):ocfs2_refcount_cow:3560 ERROR: status = -5
        (loop16,11155,0):ocfs2_prepare_inode_for_refcount:2111 ERROR: status = -5
        (loop16,11155,0):ocfs2_prepare_inode_for_write:2190 ERROR: status = -5
        (loop16,11155,0):ocfs2_file_write_iter:2331 ERROR: status = -5
        (loop16,11155,0):__ocfs2_cluster_lock:1395 ERROR: bug expression:
        lockres->l_flags & OCFS2_LOCK_FREEING
      
        (loop16,11155,0):__ocfs2_cluster_lock:1395 ERROR: Cluster lock called on
        freeing lockres T00000000000000000386019775b08d! flags 0x81
      
        kernel BUG at fs/ocfs2/dlmglue.c:1395!
      
        invalid opcode: 0000 [#1] SMP  CPU 0
        Modules linked in: tun ocfs2 jbd2 xen_blkback xen_netback xen_gntdev .. sd_mod crc_t10dif ext3 jbd mbcache
        RIP: __ocfs2_cluster_lock+0x31c/0x740 [ocfs2]
        RSP: e02b:ffff88017c0138a0  EFLAGS: 00010086
        Process loop16 (pid: 11155, threadinfo ffff88017c010000, task ffff8801b5374300)
        Call Trace:
           ocfs2_refcount_lock+0xae/0x130 [ocfs2]
           __ocfs2_lock_refcount_tree+0x29/0xe0 [ocfs2]
           ocfs2_lock_refcount_tree+0xdd/0x320 [ocfs2]
           ocfs2_refcount_cow_hunk+0x1cb/0x440 [ocfs2]
           ocfs2_refcount_cow+0xa9/0x1d0 [ocfs2]
           ocfs2_prepare_inode_for_refcount+0x115/0x200 [ocfs2]
           ocfs2_prepare_inode_for_write+0x33b/0x470 [ocfs2]
           ocfs2_file_write_iter+0x220/0x8c0 [ocfs2]
           aio_write_iter+0x2e/0x30
      
      Fix this by avoiding the second call to ocfs2_refcount_tree_put()
      
      Link: http://lkml.kernel.org/r/[email protected]Signed-off-by: default avatarAshish Samant <[email protected]>
      Reviewed-by: default avatarEric Ren <[email protected]>
      Cc: Mark Fasheh <[email protected]>
      Cc: Joel Becker <[email protected]>
      Cc: Junxiao Bi <[email protected]>
      Cc: Joseph Qi <[email protected]>
      Signed-off-by: default avatarAndrew Morton <[email protected]>
      Signed-off-by: default avatarLinus Torvalds <[email protected]>
      4131d538
  7. 10 Dec, 2016 4 commits
    • Darrick J. Wong's avatar
      ocfs2: implement the VFS clone_range, copy_range, and dedupe_range features · 29ac8e85
      Darrick J. Wong authored
      Connect the new VFS clone_range, copy_range, and dedupe_range features
      to the existing reflink capability of ocfs2.  Compared to the existing
      ocfs2 reflink ioctl We have to do things a little differently to support
      the VFS semantics (we can clone subranges of a file but we don't clone
      xattrs), but the VFS ioctls are more broadly supported.
      Signed-off-by: default avatarDarrick J. Wong <[email protected]>
      ---
      v2: Convert inline data files to extents files before reflinking,
      and fix i_blocks so that stat(2) output is correct.
      v3: Make zero-length dedupe consistent with btrfs behavior.
      v4: Use VFS double-inode lock routines and remove MAX_DEDUPE_LEN.
      29ac8e85
    • Darrick J. Wong's avatar
      ocfs2: charge quota for reflinked blocks · 86e59436
      Darrick J. Wong authored
      When ocfs2 shares blocks from one file to another, it's necessary to
      charge that many blocks to the quota because ocfs2 tallies block charges
      according to the number of blocks mapped, not the number of physical
      blocks used.
      
      Without this patch, reflinking X blocks and then CoWing all of them
      causes quota usage to *decrease* by X as seen in generic/305.
      Signed-off-by: default avatarDarrick J. Wong <[email protected]>
      86e59436
    • Darrick J. Wong's avatar
      ocfs2: budget for extent tree splits when adding refcount flag · 3e10b793
      Darrick J. Wong authored
      When we're adding the refcount flag to an extent, we have to budget
      enough space to handle a full extent btree split in addition to
      whatever modifications have to be made to the refcount btree.  We
      don't currently do this, with the result that generic/186 crashes
      when we need an extent split but not a refcount split because meta_ac
      never gets allocated.
      Signed-off-by: default avatarDarrick J. Wong <[email protected]>
      3e10b793
    • Darrick J. Wong's avatar
      ocfs2: convert inode refcount test to a helper · 84e40080
      Darrick J. Wong authored
      Replace the open-coded inode refcount flag test with a helper function
      to reduce the potential for bugs.
      Signed-off-by: default avatarDarrick J. Wong <[email protected]>
      84e40080
  8. 28 Sep, 2016 1 commit
  9. 12 May, 2016 1 commit
  10. 04 Apr, 2016 2 commits
    • Kirill A. Shutemov's avatar
      mm, fs: remove remaining PAGE_CACHE_* and page_cache_{get,release} usage · ea1754a0
      Kirill A. Shutemov authored
      Mostly direct substitution with occasional adjustment or removing
      outdated comments.
      Signed-off-by: default avatarKirill A. Shutemov <[email protected]>
      Acked-by: default avatarMichal Hocko <[email protected]>
      Signed-off-by: default avatarLinus Torvalds <[email protected]>
      ea1754a0
    • Kirill A. Shutemov's avatar
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov authored
      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: default avatarKirill A. Shutemov <[email protected]>
      Acked-by: default avatarMichal Hocko <[email protected]>
      Signed-off-by: default avatarLinus Torvalds <[email protected]>
      09cbfeaf
  11. 22 Jan, 2016 1 commit
    • Al Viro's avatar
      wrappers for ->i_mutex access · 5955102c
      Al Viro authored
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: default avatarAl Viro <[email protected]>
      5955102c
  12. 06 Nov, 2015 1 commit
  13. 04 Sep, 2015 2 commits
  14. 23 Jul, 2015 1 commit
  15. 25 Jun, 2015 1 commit
  16. 15 Apr, 2015 1 commit
  17. 14 Apr, 2015 1 commit
  18. 10 Feb, 2015 1 commit
  19. 07 Aug, 2014 1 commit
  20. 23 Jun, 2014 1 commit
    • Wengang Wang's avatar
      ocfs2: refcount: take rw_lock in ocfs2_reflink · 8a8ad1c2
      Wengang Wang authored
      This patch tries to fix this crash:
      
       #5 [ffff88003c1cd690] do_invalid_op at ffffffff810166d5
       #6 [ffff88003c1cd730] invalid_op at ffffffff8159b2de
          [exception RIP: ocfs2_direct_IO_get_blocks+359]
          RIP: ffffffffa05dfa27  RSP: ffff88003c1cd7e8  RFLAGS: 00010202
          RAX: 0000000000000000  RBX: ffff88003c1cdaa8  RCX: 0000000000000000
          RDX: 000000000000000c  RSI: ffff880027a95000  RDI: ffff88003c79b540
          RBP: ffff88003c1cd858   R8: 0000000000000000   R9: ffffffff815f6ba0
          R10: 00000000000001c9  R11: 00000000000001c9  R12: ffff88002d271500
          R13: 0000000000000001  R14: 0000000000000000  R15: 0000000000001000
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
       #7 [ffff88003c1cd860] do_direct_IO at ffffffff811cd31b
       #8 [ffff88003c1cd950] direct_IO_iovec at ffffffff811cde9c
       #9 [ffff88003c1cd9b0] do_blockdev_direct_IO at ffffffff811ce764
      #10 [ffff88003c1cdb80] __blockdev_direct_IO at ffffffff811ce7cc
      #11 [ffff88003c1cdbb0] ocfs2_direct_IO at ffffffffa05df756 [ocfs2]
      #12 [ffff88003c1cdbe0] generic_file_direct_write_iter at ffffffff8112f935
      #13 [ffff88003c1cdc40] ocfs2_file_write_iter at ffffffffa0600ccc [ocfs2]
      #14 [ffff88003c1cdd50] do_aio_write at ffffffff8119126c
      #15 [ffff88003c1cddc0] aio_rw_vect_retry at ffffffff811d9bb4
      #16 [ffff88003c1cddf0] aio_run_iocb at ffffffff811db880
      #17 [ffff88003c1cde30] io_submit_one at ffffffff811dc238
      #18 [ffff88003c1cde80] do_io_submit at ffffffff811dc437
      #19 [ffff88003c1cdf70] sys_io_submit at ffffffff811dc530
      #20 [ffff88003c1cdf80] system_call_fastpath at ffffffff8159a159
      
      It crashes at
              BUG_ON(create && (ext_flags & OCFS2_EXT_REFCOUNTED));
      in ocfs2_direct_IO_get_blocks.
      
      ocfs2_direct_IO_get_blocks is expecting the OCFS2_EXT_REFCOUNTED be removed in
      ocfs2_prepare_inode_for_write() if it was there. But no cluster lock is taken
      during the time before (or inside) ocfs2_prepare_inode_for_write() and after
      ocfs2_direct_IO_get_blocks().
      
      It can happen in this case:
      
      Node A(which crashes)				Node B
      ------------------------                 ---------------------------
      ocfs2_file_aio_write
        ocfs2_prepare_inode_for_write
          ocfs2_inode_lock
          ...
          ocfs2_inode_unlock
        #no refcount found
      ....					ocfs2_reflink
                                                ocfs2_inode_lock
                                                ...
                                                ocfs2_inode_unlock
                                                #now, refcount flag set on extent
      
                                              ...
                                              flush change to disk
      
      ocfs2_direct_IO_get_blocks
        ocfs2_get_clusters
          #extent map miss
          #buffer_head miss
          read extents from disk
        found refcount flag on extent
        crash..
      
      Fix:
      Take rw_lock in ocfs2_reflink path
      Signed-off-by: default avatarWengang Wang <[email protected]>
      Reviewed-by: default avatarMark Fasheh <[email protected]>
      Cc: Joel Becker <[email protected]>
      Signed-off-by: default avatarAndrew Morton <[email protected]>
      Signed-off-by: default avatarLinus Torvalds <[email protected]>
      8a8ad1c2
  21. 04 Jun, 2014 1 commit
  22. 26 Jan, 2014 1 commit
  23. 13 Nov, 2013 3 commits
  24. 11 Sep, 2013 1 commit
  25. 14 Aug, 2013 1 commit
  26. 31 Jul, 2013 1 commit
  27. 23 Feb, 2013 1 commit
  28. 13 Feb, 2013 1 commit
  29. 29 Jul, 2012 2 commits
  30. 13 Apr, 2012 2 commits