1. 27 8月, 2008 1 次提交
    • S
      GFS2: Fix & clean up GFS2 rename · 0188d6c5
      Steven Whitehouse 提交于
      This patch fixes a locking issue in the rename code by ensuring that we hold
      the per sb rename lock over both directory and "other" renames which involve
      different parent directories.
      
      At the same time, this moved the (only called from one place) function
      gfs2_ok_to_move into the file that its called from, so we can mark it
      static. This should make a code a bit easier to follow.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Peter Staubach <staubach@redhat.com>
      0188d6c5
  2. 13 8月, 2008 3 次提交
    • B
      GFS2: rm on multiple nodes causes panic · 72dbf479
      Bob Peterson 提交于
      This patch fixes a problem whereby simultaneous unlink, rmdir,
      rename and link operations (e.g. rm -fR *) from multiple nodes
      on the same GFS2 file system can cause kernel panics, hangs,
      and/or memory corruption.  It also gets rid of all the non-rgrp
      calls to gfs2_glock_nq_m.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      72dbf479
    • S
      GFS2: Fix metafs mounts · 9b8df98f
      Steven Whitehouse 提交于
      This patch is intended to fix the issues reported in bz #457798. Instead
      of having the metafs as a separate filesystem, it becomes a second root
      of gfs2. As a result it will appear as type gfs2 in /proc/mounts, but it
      is still possible (for backwards compatibility purposes) to mount it as
      type gfs2meta. A new mount flag "meta" is introduced so that its possible
      to tell the two cases apart in /proc/mounts.
      
      As a result it becomes possible to mount type gfs2 with -o meta and
      get the same result as mounting type gfs2meta. So it is possible to
      mount just the metafs on its own. Currently if you do this, its then
      impossible to mount the "normal" root of the gfs2 filesystem without
      first unmounting the metafs root. I'm not sure if thats a feature or
      a bug :-)
      
      Either way, this is a great improvement on the previous scheme and I've
      verified that it works ok with bind mounts on both the "normal" root
      and the metafs root in various combinations.
      
      There were also a bunch of functions in super.c which didn't belong there,
      so this moves them into ops_fstype.c where they can be static. Hopefully
      the mount/umount sequence is now more obvious as a result.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Alexander Viro <aviro@redhat.com>
      9b8df98f
    • S
      GFS2: Fix debugfs glock file iterator · c1e817d0
      Steven Whitehouse 提交于
      Due to an incorrect iterator, some glocks were being missed from the
      glock dumps obtained via debugfs. This patch fixes the problem and
      ensures that we don't miss any glocks in future.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      c1e817d0
  3. 27 7月, 2008 3 次提交
  4. 11 7月, 2008 1 次提交
  5. 10 7月, 2008 3 次提交
  6. 07 7月, 2008 2 次提交
    • S
      [GFS2] Allow local DF locks when holding a cached EX glock · 209806ab
      Steven Whitehouse 提交于
      We already allow local SH locks while we hold a cached EX glock, so here
      we allow DF locks as well. This works only because we rely on the VFS's
      invalidation for locally cached data, and because if we hold an EX lock,
      then we know that no other node can be caching data relating to this
      file.
      
      It dramatically speeds up initial writes to O_DIRECT files since we fall
      back to buffered I/O for this and would otherwise bounce between DF and
      EX modes on each and every write call. The lessons to be learned from
      that are to ensure that (for the time being anyway) O_DIRECT files are
      preallocated and that they are written to using reasonably large I/O
      sizes. Even so this change fixes that corner case nicely
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      209806ab
    • S
      [GFS2] Fix delayed demote race · 265d529c
      Steven Whitehouse 提交于
      There is a race in the delayed demote code where it does the wrong thing
      if a demotion to UN has occurred for other reasons before the delay has
      expired. This patch adds an assert to catch that condition as well as
      fixing the root cause by adding an additional check for the UN state.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Bob Peterson <rpeterso@redhat.com>
      265d529c
  7. 03 7月, 2008 2 次提交
    • M
      [GFS2] don't call permission() · f58ba889
      Miklos Szeredi 提交于
      GFS2 calls permission() to verify permissions after locks on the files
      have been taken.
      
      For this it's sufficient to call gfs2_permission() instead.  This
      results in the following changes:
      
        - IS_RDONLY() check is not performed
        - IS_IMMUTABLE() check is not performed
        - devcgroup_inode_permission() is not called
        - security_inode_permission() is not called
      
      IS_RDONLY() should be unnecessary anyway, as the per-mount read-only
      flag should provide protection against read-only remounts during
      operations.  do_gfs2_set_flags() has been fixed to perform
      mnt_want_write()/mnt_drop_write() to protect against remounting
      read-only.
      
      IS_IMMUTABLE has been added to gfs2_permission()
      
      Repeating the security checks seems to be pointless, as they don't
      normally change, and if they do, it's independent of the filesystem
      state.
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      f58ba889
    • A
      Remove BKL from remote_llseek v2 · 9465efc9
      Andi Kleen 提交于
      - Replace remote_llseek with generic_file_llseek_unlocked (to force compilation
      failures in all users)
      - Change all users to either use generic_file_llseek_unlocked directly or
      take the BKL around. I changed the file systems who don't use the BKL
      for anything (CIFS, GFS) to call it directly. NCPFS and SMBFS and NFS
      take the BKL, but explicitely in their own source now.
      
      I moved them all over in a single patch to avoid unbisectable sections.
      
      Open problem: 32bit kernels can corrupt fpos because its modification
      is not atomic, but they can do that anyways because there's other paths who
      modify it without BKL.
      
      Do we need a special lock for the pos/f_version = 0 checks?
      
      Trond says the NFS BKL is likely not needed, but keep it for now
      until his full audit.
      
      v2: Use generic_file_llseek_unlocked instead of remote_llseek_unlocked
          and factor duplicated code (suggested by hch)
      
      Cc: Trond.Myklebust@netapp.com
      Cc: swhiteho@redhat.com
      Cc: sfrench@samba.org
      Cc: vandrove@vc.cvut.cz
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      9465efc9
  8. 27 6月, 2008 11 次提交
    • S
      [GFS2] Fix module building · f17172e0
      Steven Whitehouse 提交于
      Two lines missed from the previous patch.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      f17172e0
    • S
      [GFS2] Remove all_list from lock_dlm · 31fcba00
      Steven Whitehouse 提交于
      I discovered that we had a list onto which every lock_dlm
      lock was being put. Its only function was to discover whether
      we'd got any locks left after umount. Since there was already
      a counter for that purpose as well, I removed the list. The
      saving is sizeof(struct list_head) per glock - well worth
      having.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      31fcba00
    • S
      [GFS2] Remove obsolete conversion deadlock avoidance code · b2cad26c
      Steven Whitehouse 提交于
      This is only used by GFS1 so can be removed.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      b2cad26c
    • S
      [GFS2] Remove remote lock dropping code · 1bdad606
      Steven Whitehouse 提交于
      There are several reasons why this is undesirable:
      
       1. It never happens during normal operation anyway
       2. If it does happen it causes performance to be very, very poor
       3. It isn't likely to solve the original problem (memory shortage
          on remote DLM node) it was supposed to solve
       4. It uses a bunch of arbitrary constants which are unlikely to be
          correct for any particular situation and for which the tuning seems
          to be a black art.
       5. In an N node cluster, only 1/N of the dropped locked will actually
          contribute to solving the problem on average.
      
      So all in all we are better off without it. This also makes merging
      the lock_dlm module into GFS2 a bit easier.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      1bdad606
    • B
      [GFS2] kernel panic mounting volume · 9171f5a9
      Bob Peterson 提交于
      This patch fixes Red Hat bugzilla bug 450156.
      
      This started with a not-too-improbable mount failure because the
      locking protocol was never set back to its proper "lock_dlm" after the
      system was rebooted in the middle of a gfs2_fsck.  That left a
      (purposely) invalid locking protocol in the superblock, which caused an
      error when the file system was mounted the next time.
      
      When there's an error mounting, vfs calls DQUOT_OFF, which calls
      vfs_quota_off which calls gfs2_sync_fs.  Next, gfs2_sync_fs calls
      gfs2_log_flush passing s_fs_info.  But due to the error, s_fs_info
      had been previously set to NULL, and so we have the kernel oops.
      
      My solution in this patch is to test for the NULL value before passing
      it.  I tested this patch and it fixes the problem.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      9171f5a9
    • S
      [GFS2] Revise readpage locking · 01b7c7ae
      Steven Whitehouse 提交于
      The previous attempt to fix the locking in readpage failed due
      to the use of a "try lock" which resulted in occasional high
      cpu usage during testing (due to repeated tries) and also it
      did not resolve all the ordering problems wrt the transaction
      lock (although it did solve all the inode lock ordering problems).
      
      This patch avoids the problem by unlocking the page and getting the
      locks in the correct order. This means that we have to retest the
      page to ensure that it hasn't changed when we relock the page.
      
      This now passes the tests which were previously failing.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      01b7c7ae
    • S
      [GFS2] Fix ordering of args for list_add · 80274737
      Steven Whitehouse 提交于
      The patch to remove lock_nolock managed to get the arguments
      of this list_add backwards. This fixes it.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      80274737
    • H
      [GFS2] trivial sparse lock annotations · 2d81afb8
      Harvey Harrison 提交于
      Annotate the &sdp->sd_log_lock.
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      2d81afb8
    • S
      [GFS2] No lock_nolock · 048bca22
      Steven Whitehouse 提交于
      This patch merges the lock_nolock module into GFS2 itself. As well as removing
      some of the overhead of the module, it also means that its now impossible to
      build GFS2 without a lock module (which would be a pointless thing to do
      anyway).
      
      We also plan to merge lock_dlm into GFS2 in the future, but that is a more
      tricky task, and will therefore be a separate patch.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: David Teigland <teigland@redhat.com>
      048bca22
    • S
      [GFS2] Fix ordering bug in lock_dlm · f3c9d38a
      Steven Whitehouse 提交于
      This looks like a lot of change, but in fact its not. Mostly its
      things moving from one file to another. The change is just that
      instead of queuing lock completions and callbacks from the DLM
      we now pass them directly to GFS2.
      
      This gives us a net loss of two list heads per glock (a fair
      saving in memory) plus a reduction in the latency of delivering
      the messages to GFS2, plus we now have one thread fewer as well.
      There was a bug where callbacks and completions could be delivered
      in the wrong order due to this unnecessary queuing which is fixed
      by this patch.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Bob Peterson <rpeterso@redhat.com>
      f3c9d38a
    • S
      [GFS2] Clean up the glock core · 6802e340
      Steven Whitehouse 提交于
      This patch implements a number of cleanups to the core of the
      GFS2 glock code. As a result a lot of code is removed. It looks
      like a really big change, but actually a large part of this patch
      is either removing or moving existing code.
      
      There are some new bits too though, such as the new run_queue()
      function which is considerably streamlined. Highlights of this
      patch include:
      
       o Fixes a cluster coherency bug during SH -> EX lock conversions
       o Removes the "glmutex" code in favour of a single bit lock
       o Removes the ->go_xmote_bh() for inodes since it was duplicating
         ->go_lock()
       o We now only use the ->lm_lock() function for both locks and
         unlocks (i.e. unlock is a lock with target mode LM_ST_UNLOCKED)
       o The fast path is considerably shortly, giving performance gains
         especially with lock_nolock
       o The glock_workqueue is now used for all the callbacks from the DLM
         which allows us to simplify the lock_dlm module (see following patch)
       o The way is now open to make further changes such as eliminating the two
         threads (gfs2_glockd and gfs2_scand) in favour of a more efficient
         scheme.
      
      This patch has undergone extensive testing with various test suites
      so it should be pretty stable by now.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Bob Peterson <rpeterso@redhat.com>
      6802e340
  9. 25 6月, 2008 1 次提交
    • B
      [GFS2] fix gfs2 block allocation (cleaned up) · 5af4e7a0
      Benjamin Marzinski 提交于
      This patch fixes bz 450641.
      
      This patch changes the computation for zero_metapath_length(), which it
      renames to metapath_branch_start(). When you are extending the metadata
      tree, The indirect blocks that point to the new data block must either
      diverge from the existing tree either at the inode, or at the first
      indirect block. They can diverge at the first indirect block because the
      inode has room for 483 pointers while the indirect blocks have room for
      509 pointers, so when the tree is grown, there is some free space in the
      first indirect block. What metapath_branch_start() now computes is the
      height where the first indirect block for the new data block is located.
      It can either be 1 (if the indirect block diverges from the inode) or 2
      (if it diverges from the first indirect block).
      Signed-off-by: NBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      5af4e7a0
  10. 24 6月, 2008 1 次提交
  11. 12 5月, 2008 3 次提交
  12. 30 4月, 2008 1 次提交
  13. 28 4月, 2008 1 次提交
  14. 22 4月, 2008 1 次提交
  15. 18 4月, 2008 1 次提交
  16. 10 4月, 2008 1 次提交
  17. 31 3月, 2008 4 次提交
    • J
      [GFS2] test for IS_ERR rather than 0 · 773adff8
      Julia Lawall 提交于
      The function gfs2_inode_lookup always returns either a valid pointer or a
      value made with ERR_PTR, so its result should be tested with IS_ERR, not
      with a test for 0.
      
      The problem was found using the following semantic match.
      (http://www.emn.fr/x-info/coccinelle/)
      
      //<smpl>
      @a@
      expression E, E1;
      statement S,S1;
      position p;
      @@
      
      E = gfs2_inode_lookup(...)
      ... when != E = E1
      if@p (E) S else S1
      
      @n@
      position a.p;
      expression E,E1;
      statement S,S1;
      @@
      
      E = NULL
      ... when != E = E1
      if@p (E) S else S1
      
      @depends on !n@
      expression E;
      statement S,S1;
      position a.p;
      @@
      
      * if@p (E)
        S else S1
      //</smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      773adff8
    • B
      [GFS2] Invalidate cache at correct point · 58e9fee1
      Benjamin Marzinski 提交于
      GFS2 wasn't invalidating its cache before it called into the lock manager
      with a request that could potentially drop a lock.  This was leaving a
      window where the lock could be actually be held by another node, but the
      file's page cache would still appear valid, causing coherency problems.
      This patch moves the cache invalidation to before the lock manager call
      when dropping a lock. It also adds the option to the lock_dlm lock
      manager to not use conversion mode deadlock avoidance, which, on a
      conversion from shared to exclusive, could internally drop the lock, and
      then reacquire in. GFS2 now asks lock_dlm to not do this.  Instead, GFS2
      manually drops the lock and reacquires it.
      Signed-off-by: NBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      58e9fee1
    • A
      [GFS2] fs/gfs2/recovery.c: suppress warnings · f5a8cd02
      akpm@linux-foundation.org 提交于
      fs/gfs2/recovery.c: In function 'get_log_header':
      fs/gfs2/recovery.c:152: warning: 'lh.lh_sequence' may be used uninitialized in this function
      fs/gfs2/recovery.c:152: warning: 'lh.lh_flags' may be used uninitialized in this function
      fs/gfs2/recovery.c:152: warning: 'lh.lh_tail' may be used uninitialized in this function
      fs/gfs2/recovery.c:152: warning: 'lh.lh_blkno' may be used uninitialized in this function
      fs/gfs2/recovery.c:152: warning: 'lh.lh_hash' may be used uninitialized in this function
      
      Cc: David Teigland <teigland@redhat.com>
      Cc: Bob Peterson <rpeterso@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      f5a8cd02
    • B
      [GFS2] Faster gfs2_bitfit algorithm · 1f466a47
      Bob Peterson 提交于
      This version of the gfs2_bitfit algorithm includes the latest
      suggestions from Steve Whitehouse.  It is typically eight to
      ten times faster than the version we're using today.  If there
      is a lot of metadata mixed in (lots of small files) the
      algorithm is often 15 times faster, and given the right
      conditions, I've seen peaks of 20 times faster.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      1f466a47