1. 07 9月, 2017 1 次提交
  2. 23 12月, 2016 1 次提交
  3. 13 12月, 2016 1 次提交
    • A
      ocfs2: fix double put of recount tree in ocfs2_lock_refcount_tree() · 4131d538
      Ashish Samant 提交于
      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/1473984404-32011-1-git-send-email-ashish.samant@oracle.comSigned-off-by: NAshish Samant <ashish.samant@oracle.com>
      Reviewed-by: NEric Ren <zren@suse.com>
      Cc: Mark Fasheh <mfasheh@versity.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Joseph Qi <jiangqi903@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4131d538
  4. 11 12月, 2016 4 次提交
  5. 28 9月, 2016 1 次提交
  6. 13 5月, 2016 1 次提交
    • J
      ocfs2: fix posix_acl_create deadlock · c25a1e06
      Junxiao Bi 提交于
      Commit 702e5bc6 ("ocfs2: use generic posix ACL infrastructure")
      refactored code to use posix_acl_create.  The problem with this function
      is that it is not mindful of the cluster wide inode lock making it
      unsuitable for use with ocfs2 inode creation with ACLs.  For example,
      when used in ocfs2_mknod, this function can cause deadlock as follows.
      The parent dir inode lock is taken when calling posix_acl_create ->
      get_acl -> ocfs2_iop_get_acl which takes the inode lock again.  This can
      cause deadlock if there is a blocked remote lock request waiting for the
      lock to be downconverted.  And same deadlock happened in ocfs2_reflink.
      This fix is to revert back using ocfs2_init_acl.
      
      Fixes: 702e5bc6 ("ocfs2: use generic posix ACL infrastructure")
      Signed-off-by: NTariq Saeed <tariq.x.saeed@oracle.com>
      Signed-off-by: NJunxiao Bi <junxiao.bi@oracle.com>
      Cc: Mark Fasheh <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Joseph Qi <joseph.qi@huawei.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c25a1e06
  7. 05 4月, 2016 2 次提交
    • K
      mm, fs: remove remaining PAGE_CACHE_* and page_cache_{get,release} usage · ea1754a0
      Kirill A. Shutemov 提交于
      Mostly direct substitution with occasional adjustment or removing
      outdated comments.
      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>
      ea1754a0
    • 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
  8. 23 1月, 2016 1 次提交
    • A
      wrappers for ->i_mutex access · 5955102c
      Al Viro 提交于
      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: NAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  9. 06 11月, 2015 1 次提交
  10. 05 9月, 2015 2 次提交
  11. 24 7月, 2015 1 次提交
  12. 25 6月, 2015 1 次提交
  13. 16 4月, 2015 1 次提交
  14. 15 4月, 2015 1 次提交
  15. 11 2月, 2015 1 次提交
  16. 07 8月, 2014 1 次提交
  17. 24 6月, 2014 1 次提交
    • W
      ocfs2: refcount: take rw_lock in ocfs2_reflink · 8a8ad1c2
      Wengang Wang 提交于
      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: NWengang Wang <wen.gang.wang@oracle.com>
      Reviewed-by: NMark Fasheh <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8a8ad1c2
  18. 05 6月, 2014 1 次提交
  19. 26 1月, 2014 1 次提交
  20. 13 11月, 2013 3 次提交
  21. 12 9月, 2013 1 次提交
  22. 14 8月, 2013 1 次提交
  23. 01 8月, 2013 1 次提交
  24. 23 2月, 2013 1 次提交
  25. 13 2月, 2013 1 次提交
  26. 30 7月, 2012 2 次提交
  27. 14 4月, 2012 3 次提交
  28. 20 7月, 2011 1 次提交
  29. 25 5月, 2011 1 次提交
  30. 10 4月, 2011 1 次提交