1. 05 1月, 2009 2 次提交
    • S
      GFS2: Rationalise header files · b2760583
      Steven Whitehouse 提交于
      Move the contents of some headers which contained very
      little into more sensible places, and remove the original
      header files. This should make it easier to find things.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      b2760583
    • S
      GFS2: Support for FIEMAP ioctl · e9079cce
      Steven Whitehouse 提交于
      This patch implements the FIEMAP ioctl for GFS2. We can use the generic
      code (aside from a lock order issue, solved as per Ted Tso's suggestion)
      for which I've introduced a new variant of the generic function. We also
      have one exception to deal with, namely stuffed files, so we do that
      "by hand", setting all the required flags.
      
      This has been tested with a modified (I could only find an old version) of
      Eric's test program, and appears to work correctly.
      
      This patch does not currently support FIEMAP of xattrs, but the plan is to add
      that feature at some future point.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Theodore Tso <tytso@mit.edu>
      Cc: Eric Sandeen <sandeen@redhat.com>
      e9079cce
  2. 23 10月, 2008 1 次提交
  3. 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
  4. 13 8月, 2008 1 次提交
  5. 27 7月, 2008 2 次提交
  6. 03 7月, 2008 1 次提交
    • 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
  7. 31 3月, 2008 5 次提交
    • S
      [GFS2] Streamline quota lock/check for no-quota case · d82661d9
      Steven Whitehouse 提交于
      This patch streamlines the quota checking in the "no quota" case by
      making the check inline in the calling function, thus reducing the
      number of function calls. Eventually we might be able to remove the
      checks from the gfs2_quota_lock() and gfs2_quota_check() functions, but
      currently we can't as there are a very few places in the code which need
      to call these functions directly still.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Abhijith Das <adas@redhat.com>
      d82661d9
    • C
      [GFS2] possible null pointer dereference fixup · 182fe5ab
      Cyrill Gorcunov 提交于
      gfs2_alloc_get may fail so we have to check it to prevent
      NULL pointer dereference.
      Signed-off-by: NCyrill Gorcunov <gorcunov@gamil.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      182fe5ab
    • D
      [GFS2] remove gfs2_dev_iops · d83225d4
      Denis Cheng 提交于
      struct inode_operations gfs2_dev_iops is always the same as gfs2_file_iops,
      since Jan 2006, when GFS2 merged into mainstream kernel.
      
      So one of them could be removed.
      Signed-off-by: NDenis Cheng <crquan@gmail.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      d83225d4
    • S
      [GFS2] Fix a page lock / glock deadlock · 7afd88d9
      Steven Whitehouse 提交于
      We've previously been using a "try lock" in readpage on the basis that
      it would prevent deadlocks due to the inverted lock ordering (our normal
      lock ordering is glock first and then page lock). Unfortunately tests
      have shown that this isn't enough. If the glock has a demote request
      queued such that run_queue() in the glock code tries to do a demote when
      its called under readpage then it will try and write out all the dirty
      pages which requires locking them. This then deadlocks with the page
      locked by readpage.
      
      The solution is to always require two calls into readpage. The first
      unlocks the page, gets the glock and returns AOP_TRUNCATED_PAGE, the
      second does the actual readpage and unlocks the glock & page as
      required.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      7afd88d9
    • S
      [GFS2] Eliminate (almost) duplicate field from gfs2_inode · 77658aad
      Steven Whitehouse 提交于
      The blocks counter is almost a duplicate of the i_blocks
      field in the VFS inode. The only difference is that i_blocks
      can be only 32bits long for 32bit arch without large single file
      support. Since GFS2 doesn't handle the non-large single file
      case (for 32 bit anyway) this adds a new config dependency on
      64BIT || LSF. This has always been the case, however we've never
      explicitly said so before.
      
      Even if we do add support for the non-LSF case, we will still
      not require this field to be duplicated since we will not be
      able to access oversized files anyway.
      
      So the net result of all this is that we shave 8 bytes from a gfs2_inode
      and get our config deps correct.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      77658aad
  8. 08 2月, 2008 1 次提交
  9. 25 1月, 2008 2 次提交
    • S
      [GFS2] Reduce inode size by moving i_alloc out of line · 6dbd8224
      Steven Whitehouse 提交于
      It is possible to reduce the size of GFS2 inodes by taking the i_alloc
      structure out of the gfs2_inode. This patch allocates the i_alloc
      structure whenever its needed, and frees it afterward. This decreases
      the amount of low memory we use at the expense of requiring a memory
      allocation for each page or partial page that we write. A quick test
      with postmark shows that the overhead is not measurable and I also note
      that OCFS2 use the same approach.
      
      In the future I'd like to solve the problem by shrinking down the size
      of the members of the i_alloc structure, but for now, this reduces the
      immediate problem of using too much low-memory on x86 and doesn't add
      too much overhead.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      6dbd8224
    • S
      [GFS2] Fix problems relating to execution of files on GFS2 · 9656b2c1
      Steven Whitehouse 提交于
      This patch fixes a couple of problems which affected the execution of files
      on GFS2. The first is that there was a corner case where inodes were not
      always uptodate at the point at which permissions checks were being carried
      out, this was resulting in refusal of execute permission, but only on the
      first lookup, subsequent requests worked correctly. The second was a problem
      relating to incorrect updating of file sizes which was introduced with the
      write_begin/end code for GFS2 a little while back.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Abhijith Das <adas@redhat.com>
      9656b2c1
  10. 10 10月, 2007 3 次提交
  11. 09 7月, 2007 5 次提交
    • W
      [GFS2] inode size inconsistency · 090ffaa5
      Wendy Cheng 提交于
      This should have been part of the NFS patch #1 but somehow I missed it
      when packaging the patches. It is not a critical issue as the others (I
      hope). RHEL 5.1 31.el5 kernel runs fine without this change.
      
      Our truncate code is chopped into two parts, one for vfs inode changes
      (in vmtruncate()) and one of gfs inode (in gfs2_truncatei()). These two
      operatons are, unfortunately, not atomic. So it could happens that
      vmtruncate() succeeds (inode->i_size is changed) but gfs2_truncatei
      fails (say kernel temporarily out of memory). This would leave gfs inode
      i_di.di_size out of sync with vfs inode i_size. It will later confuse
      gfs2_commit_write() if a write is issued. Last time I checked, it will
      cause file corruption.
      Signed-off-by: NS. Wendy Cheng <wcheng@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      090ffaa5
    • S
      [GFS2] Fix typo in rename of directories · ffed8ab3
      Steven Whitehouse 提交于
      A typo caused us to pass a NULL pointer when renaming directories. It
      was accidentally introduced in: [GFS2] Clean up inode number handling
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      ffed8ab3
    • S
      [GFS2] Add nanosecond timestamp feature · 4bd91ba1
      Steven Whitehouse 提交于
      This adds a nanosecond timestamp feature to the GFS2 filesystem. Due
      to the way that the on-disk format works, older filesystems will just
      appear to have this field set to zero. When mounted by an older version
      of GFS2, the filesystem will simply ignore the extra fields so that
      it will again appear to have whole second resolution, so that its
      trivially backward compatible.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      4bd91ba1
    • S
      [GFS2] Fix sign problem in quota/statfs and cleanup _host structures · bb8d8a6f
      Steven Whitehouse 提交于
      This patch fixes some sign issues which were accidentally introduced
      into the quota & statfs code during the endianess annotation process.
      Also included is a general clean up which moves all of the _host
      structures out of gfs2_ondisk.h (where they should not have been to
      start with) and into the places where they are actually used (often only
      one place). Also those _host structures which are not required any more
      are removed entirely (which is the eventual plan for all of them).
      
      The conversion routines from ondisk.c are also moved into the places
      where they are actually used, which for almost every one, was just one
      single place, so all those are now static functions. This also cleans up
      the end of gfs2_ondisk.h which no longer needs the #ifdef __KERNEL__.
      
      The net result is a reduction of about 100 lines of code, many functions
      now marked static plus the bug fixes as mentioned above. For good
      measure I ran the code through sparse after making these changes to
      check that there are no warnings generated.
      
      This fixes Red Hat bz #239686
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      bb8d8a6f
    • S
      [GFS2] Clean up inode number handling · dbb7cae2
      Steven Whitehouse 提交于
      This patch cleans up the inode number handling code. The main difference
      is that instead of looking up the inodes using a struct gfs2_inum_host
      we now use just the no_addr member of this structure. The tests relating
      to no_formal_ino can then be done by the calling code. This has
      advantages in that we want to do different things in different code
      paths if the no_formal_ino doesn't match. In the NFS patch we want to
      return -ESTALE, but in the ->lookup() path, its a bug in the fs if the
      no_formal_ino doesn't match and thus we can withdraw in this case.
      
      In order to later fix bz #201012, we need to be able to look up an inode
      without knowing no_formal_ino, as the only information that is known to
      us is the on-disk location of the inode in question.
      
      This patch will also help us to fix bz #236099 at a later date by
      cleaning up a lot of the code in that area.
      
      There are no user visible changes as a result of this patch and there
      are no changes to the on-disk format either.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      dbb7cae2
  12. 15 2月, 2007 1 次提交
    • T
      [PATCH] remove many unneeded #includes of sched.h · cd354f1a
      Tim Schmielau 提交于
      After Al Viro (finally) succeeded in removing the sched.h #include in module.h
      recently, it makes sense again to remove other superfluous sched.h includes.
      There are quite a lot of files which include it but don't actually need
      anything defined in there.  Presumably these includes were once needed for
      macros that used to live in sched.h, but moved to other header files in the
      course of cleaning it up.
      
      To ease the pain, this time I did not fiddle with any header files and only
      removed #includes from .c-files, which tend to cause less trouble.
      
      Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
      arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
      allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
      configs in arch/arm/configs on arm.  I also checked that no new warnings were
      introduced by the patch (actually, some warnings are removed that were emitted
      by unnecessarily included header files).
      Signed-off-by: NTim Schmielau <tim@physik3.uni-rostock.de>
      Acked-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cd354f1a
  13. 13 2月, 2007 1 次提交
  14. 06 2月, 2007 5 次提交
    • R
      [GFS2] Fix unlink deadlocks · ddee7608
      Russell Cattelan 提交于
      Move the glock acquisition to outside of the transactions.
      
      Lock odering must be preserved in order to prevent ABBA
      deadlocks. The current gfs2_change_nlink code would tries
      to grab the glock after having started a transaction and thus is holding
      the log lock. This is inconsistent with other code paths in
      gfs that grab the resource group glock prior to staring
      a tranactions.
      
      One problem with this fix is that the resource group
      lock is always grabbed now even if the inode still has
      ref count and can not be marked for unlink.
      Signed-off-by: NRussell Cattelan <cattelan@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      ddee7608
    • S
      [GFS2] Fix recursive locking attempt with NFS · d7c103d0
      Steven Whitehouse 提交于
      In certain cases, its possible for NFS to call the lookup code while
      holding the glock (when doing a readdirplus operation) so we need to
      check for that and not try and lock the glock twice. This also fixes a
      typo in a previous NFS related GFS2 patch.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      d7c103d0
    • E
      [GFS2] use CURRENT_TIME_SEC instead of get_seconds in gfs2 · ddfe0627
      Eric Sandeen 提交于
      I was looking something else up and came across this...
      
      I don't honestly have a good reason to change it other than to make it
      like every other Linux filesystem in this regard.  ;-)  It doesn't
      functionally change anything, but makes some lines shorter. :)
      
      I'm also curious; why does gfs2 have 64-bits of on-disk timestamps, but
      not in timespec_t format, and only stores second resolutions?  Seems like
      you're halfway to sub-second resolutions already.
      
      I suppose if that gets implemented then all of the below should
      instead be CURRENT_TIME not CURRENT_TIME_SEC.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      ddfe0627
    • S
      [GFS2] Fix gfs2_rename deadlock · 87d21e07
      S. Wendy Cheng 提交于
      Second round of gfs2_rename lock re-ordering to allow Anaconda adding
      root partition on top of gfs2. Previous to this patch the recursive
      lock detector in glock.c can be triggered due to attempting to lock
      the rgrp twice. This fixes it by checking to see whether the rgrp
      is already locked.
      
      This fixes Red Hat bugzilla #221237
      Signed-off-by: NS. Wendy Cheng <wcheng@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      87d21e07
    • S
      [GFS2] Fix change nlink deadlock · 5509826f
      S. Wendy Cheng 提交于
      Bugzilla 215088
      
      Fix deadlock in gfs2_change_nlink() while installing RHEL5 into GFS2
      partition. The gfs2_rename() apparently needs block allocation for the
      new name (into the directory) where it requires rg locks. At the same
      time, while updating the nlink count for the replaced file,
      gfs2_change_nlink() tries to return the inode meta-data back to resource
      group where it needs rg locks too. Our logic doesn't allow process to
      acquire these locks recursively by the same process  (RHEL installer)
      that results a BUG call. This only happens within rename code path and
      only if the destination file exists before the rename operation.
      Signed-off-by: NS. Wendy Cheng <wcheng@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      5509826f
  15. 30 11月, 2006 9 次提交