1. 17 Nov, 2011 5 commits
    • Xiaowei.Hu's avatar
      ocfs2: Add a missing journal credit in ocfs2_link_credits() -v2 · 0393afea
      Xiaowei.Hu authored
      With indexed_dir enabled, ocfs2 maintains a list of dirblocks having
      space.
      
      The credit calculation in ocfs2_link_credits() did not correctly account
      for adding an entry that exactly fills a dirblock that triggers removing
      that dirblock by changing the pointer in the previous block in the list.
      The credit calculation did not account for that previous block.
      
      To expose, do:
      
      mkfs.ocfs2 -b 512 -M local /dev/sdX
      mount /dev/sdX /ocfs2
      mkdir /ocfs2/linkdir
      touch /ocfs2/linkdir/file1
      for i in `seq 1 29` ; do link /ocfs2/linkdir/file1
      /ocfs2/linkdir/linklinklinklinklinklink$i; done
      rm -f /ocfs2/linkdir/linklinklinklinklinklink10
      sleep 8
      link /ocfs2/linkdir/file1
      /ocfs2/linkdir/linklinklinklinklinklinkaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      
      Note:
      The link names have been crafted for a 512 byte blocksize. Reproducing
      with a larger blocksize will require longer (or more) links. The sleep
      is important. We want jbd2 to commit the transaction so that the missing
      block does not piggy back on account of the previous transaction.
      
      Signed-off-by: XiaoweiHu <xiaowei.hu at oracle.com>
      Reviewed-by: WengangWang <wen.gang.wang at oracle.com>
      Reviewed-by: Sunil.Mushran <sunil.mushran at oracle.com>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
      0393afea
    • Dan Magenheimer's avatar
      ocfs2: send correct UUID to cleancache initialization · e41d33af
      Dan Magenheimer authored
      ocfs2: Fix cleancache initialization call to correctly pass uuid
      
      As reported by Steven Whitehouse in https://lkml.org/lkml/2011/5/27/221
      the ocfs2 volume UUID is incorrectly passed to cleancache.
      As a result, shared-ephemeral tmem pools will not actually
      be created; instead they will be private (unshared) which
      misses out on a major benefit of tmem.
      Reported-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      Signed-off-by: default avatarDan Magenheimer <dan.magenheimer@oracle.com>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
      e41d33af
    • Wengang Wang's avatar
      ocfs2: Commit transactions in error cases -v2 · b8a0ae57
      Wengang Wang authored
      There are three cases found that in error cases, journal transactions are not
      committed nor aborted. We should take care of these case by committing the
      transactions. Otherwise, there would left a journal handle which will lead to
      , in same process context, the comming ocfs2_start_trans() gets wrong credits.
      Signed-off-by: default avatarWengang Wang <wen.gang.wang@oracle.com>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
      b8a0ae57
    • Wengang Wang's avatar
      ocfs2: make direntry invalid when deleting it · 82985248
      Wengang Wang authored
      When we deleting a direntry from a directory, if it's the first in a block we
      invalid it by setting inode to 0; otherwise, we merge the deleted one to the
      prior and contiguous direntry. And we don't truncate directories.
      
      There is a problem for the later case since inode is not set to 0.
      This problem happens when the caller passes a file position as parameter to
      ocfs2_dir_foreach_blk(). If the position happens to point to a stale(not
      the first, deleted in betweens of ocfs2_dir_foreach_blk()s) direntry, we are
      not able to recognize its staleness. So that we treat it as a live one wrongly.
      
      The fix is to set inode to 0 in both cases indicating the direntry is stale.
      This won't introduce additional IOs.
      Signed-off-by: default avatarWengang Wang <wen.gang.wang@oracle.com>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
      82985248
    • Julia Lawall's avatar
      fs/ocfs2/dlm/dlmlock.c: free kmem_cache_zalloc'd data using kmem_cache_free · fc9f8994
      Julia Lawall authored
      Memory allocated using kmem_cache_zalloc should be freed using
      kmem_cache_free, not kfree.
      
      The semantic patch that fixes this problem is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression x,e,e1,e2;
      @@
      
      x = kmem_cache_zalloc(e1,e2)
      ... when != x = e
      ?-kfree(x)
      +kmem_cache_free(e1,x)
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
      fc9f8994
  2. 22 Aug, 2011 1 commit
  3. 28 Jul, 2011 2 commits
    • Jan Kara's avatar
      ocfs2: Avoid livelock in ocfs2_readpage() · c7e25e6e
      Jan Kara authored
      When someone writes to an inode, readers accessing the same inode via
      ocfs2_readpage() just busyloop trying to get ip_alloc_sem because
      do_generic_file_read() looks up the page again and retries ->readpage()
      when previous attempt failed with AOP_TRUNCATED_PAGE. When there are enough
      readers, they can occupy all CPUs and in non-preempt kernel the system is
      deadlocked because writer holding ip_alloc_sem is never run to release the
      semaphore. Fix the problem by making reader block on ip_alloc_sem to break
      the busy loop.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
      c7e25e6e
    • Mark Fasheh's avatar
      ocfs2: serialize unaligned aio · a11f7e63
      Mark Fasheh authored
      Fix a corruption that can happen when we have (two or more) outstanding
      aio's to an overlapping unaligned region.  Ext4
      (e9e3bcec) and xfs recently had to fix
      similar issues.
      
      In our case what happens is that we can have an outstanding aio on a region
      and if a write comes in with some bytes overlapping the original aio we may
      decide to read that region into a page before continuing (typically because
      of buffered-io fallback).  Since we have no ordering guarantees with the
      aio, we can read stale or bad data into the page and then write it back out.
      
      If the i/o is page and block aligned, then we avoid this issue as there
      won't be any need to read data from disk.
      
      I took the same approach as Eric in the ext4 patch and introduced some
      serialization of unaligned async direct i/o.  I don't expect this to have an
      effect on the most common cases of AIO.  Unaligned aio will be slower
      though, but that's far more acceptable than data corruption.
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
      a11f7e63
  4. 25 Jul, 2011 1 commit
    • Sunil Mushran's avatar
      ocfs2: Implement llseek() · 93862d5e
      Sunil Mushran authored
      ocfs2 implements its own llseek() to provide the SEEK_HOLE/SEEK_DATA
      functionality.
      
      SEEK_HOLE sets the file pointer to the start of either a hole or an unwritten
      (preallocated) extent, that is greater than or equal to the supplied offset.
      
      SEEK_DATA sets the file pointer to the start of an allocated extent (not
      unwritten) that is greater than or equal to the supplied offset.
      
      If the supplied offset is on a desired region, then the file pointer is set
      to it. Offsets greater than or equal to the file size return -ENXIO.
      
      Unwritten (preallocated) extents are considered holes because the file system
      treats reads to such regions in the same way as it does to holes.
      Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
      93862d5e
  5. 24 Jul, 2011 31 commits