1. 05 Jan, 2009 28 commits
    • Julia Lawall's avatar
      GFS2: Use DEFINE_SPINLOCK · eb8374e7
      Julia Lawall authored
      SPIN_LOCK_UNLOCKED is deprecated.  The following makes the change suggested
      in Documentation/spinlocks.txt
      
      The semantic patch that makes this change is as follows:
      (http://www.emn.fr/x-info/coccinelle/)
      
      // <smpl>
      @@
      declarer name DEFINE_SPINLOCK;
      identifier xxx_lock;
      @@
      
      - spinlock_t xxx_lock = SPIN_LOCK_UNLOCKED;
      + DEFINE_SPINLOCK(xxx_lock);
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      eb8374e7
    • Steven Whitehouse's avatar
      GFS2: Fix use-after-free bug on umount (try #2) · 88a19ad0
      Steven Whitehouse authored
      This should solve the issue with the previous attempt at fixing this.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      88a19ad0
    • Steven Whitehouse's avatar
      Revert "GFS2: Fix use-after-free bug on umount" · fefc03bf
      Steven Whitehouse authored
      This reverts commit 78802499912f1ba31ce83a94c55b5a980f250a43.
      
      The original patch is causing problems in relation to order of
      operations at umount in relation to jdata files. I need to fix
      this a different way.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      fefc03bf
    • Steven Whitehouse's avatar
      GFS2: Streamline alloc calculations for writes · 7ed122e4
      Steven Whitehouse authored
      This patch removes some unused code, and make the calculation
      of the number of blocks required conditional in order to reduce
      the number of times this (potentially expensive) calculation
      is done.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      7ed122e4
    • Steven Whitehouse's avatar
      GFS2: Send useful information with uevent messages · 9a776db7
      Steven Whitehouse authored
      In order to distinguish between two differing uevent messages
      and to avoid using the (racy) method of reading status from
      sysfs in future, this adds some status information to our
      uevent messages.
      
      Btw, before anybody says "sysfs isn't racy", I'm aware of that,
      but the way that GFS2 was using it (send an ambiugous uevent and
      then expect the receiver to read sysfs to find out the status
      of the reported operation) was.
      
      The additional benefit of using the new interface is that it
      should be possible for a node to recover multiple journals
      at the same time, since there is no longer any confusion as
      to which journal the status belongs to.
      
      At some future stage, when all the userland programs have been
      converted, I intend to remove the old interface.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      9a776db7
    • Steven Whitehouse's avatar
      GFS2: Fix use-after-free bug on umount · 3af165ac
      Steven Whitehouse authored
      There was a use-after-free with the GFS2 super block during
      umount. This patch moves almost all of the umount code from
      ->put_super into ->kill_sb, the only bit that cannot be moved
      being the glock hash clearing which has to remain as ->put_super
      due to umount ordering requirements. As a result its now obvious
      that the kfree is the final operation, whereas before it was
      hidden in ->put_super.
      
      Also gfs2_jindex_free is then only referenced from a single file
      so thats moved and marked static too.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      3af165ac
    • Steven Whitehouse's avatar
      GFS2: Remove ancient, unused code · 2e204703
      Steven Whitehouse authored
      Remove code that used to have something to do with initrd
      but has been unused for a long time.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      2e204703
    • Steven Whitehouse's avatar
      GFS2: Move four functions from super.c · 2bfb6449
      Steven Whitehouse authored
      The functions which are being moved can all be marked
      static in their new locations, since they only have
      a single caller each. Their new locations are more
      logical than before and some of the functions are
      small enough that the compiler might well inline them.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      2bfb6449
    • Steven Whitehouse's avatar
      GFS2: Fix bug in gfs2_lock_fs_check_clean() · b5289681
      Steven Whitehouse authored
      gfs2_lock_fs_check_clean() should not be calling gfs2_jindex_hold()
      since it doesn't work like rindex hold, despite the comment. That
      allows gfs2_jindex_hold() to be moved into ops_fstype.c where it
      can be made static.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      b5289681
    • Steven Whitehouse's avatar
      GFS2: Send some sensible sysfs stuff · fdd1062e
      Steven Whitehouse authored
      We ought to inform the user of the locktable and lockproto for each
      uevent we generate.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      fdd1062e
    • Steven Whitehouse's avatar
      GFS2: Kill two daemons with one patch · 97cc1025
      Steven Whitehouse authored
      This patch removes the two daemons, gfs2_scand and gfs2_glockd
      and replaces them with a shrinker which is called from the VM.
      
      The net result is that GFS2 responds better when there is memory
      pressure, since it shrinks the glock cache at the same rate
      as the VFS shrinks the dcache and icache. There are no longer
      any time based criteria for shrinking glocks, they are kept
      until such time as the VM asks for more memory and then we
      demote just as many glocks as required.
      
      There are potential future changes to this code, including the
      possibility of sorting the glocks which are to be written back
      into inode number order, to get a better I/O ordering. It would
      be very useful to have an elevator based workqueue implementation
      for this, as that would automatically deal with the read I/O cases
      at the same time.
      
      This patch is my answer to Andrew Morton's remark, made during
      the initial review of GFS2, asking why GFS2 needs so many kernel
      threads, the answer being that it doesn't :-) This patch is a
      net loss of about 200 lines of code.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      97cc1025
    • Steven Whitehouse's avatar
      GFS2: Move gfs2_recoverd into recovery.c · 9ac1b4d9
      Steven Whitehouse authored
      By moving gfs2_recoverd, we can make an additional function static
      and it also leaves only (the already scheduled for removal) gfs2_glockd
      in daemon.c.
      
      At the same time the declaration of gfs2_quotad is moved to quota.h
      to reflect the new location of gfs2_quotad in a previous patch. Also
      the recovery.h and quota.h headers are cleaned up.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      9ac1b4d9
    • Steven Whitehouse's avatar
      GFS2: Fix "truncate in progress" hang · 813e0c46
      Steven Whitehouse authored
      Following on from the recent clean up of gfs2_quotad, this patch moves
      the processing of "truncate in progress" inodes from the glock workqueue
      into gfs2_quotad. This fixes a hang due to the "truncate in progress"
      processing requiring glocks in order to complete.
      
      It might seem odd to use gfs2_quotad for this particular item, but
      we have to use a pre-existing thread since creating a thread implies
      a GFP_KERNEL memory allocation which is not allowed from the glock
      workqueue context. Of the existing threads, gfs2_logd and gfs2_recoverd
      may deadlock if used for this operation. gfs2_scand and gfs2_glockd are
      both scheduled for removal at some (hopefully not too distant) future
      point. That leaves only gfs2_quotad whose workload is generally fairly
      light and is easily adapted for this extra task.
      
      Also, as a result of this change, it opens the way for a future patch to
      make the reading of the inode's information asynchronous with respect to
      the glock workqueue, which is another improvement that has been on the list
      for some time now.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      813e0c46
    • Steven Whitehouse's avatar
      GFS2: Clean up & move gfs2_quotad · 37b2c837
      Steven Whitehouse authored
      This patch is a clean up of gfs2_quotad prior to giving it an
      extra job to do in addition to the current portfolio of updating
      the quota and statfs information from time to time.
      
      As a result it has been moved into quota.c allowing one of the
      functions it calls to be made static. Also the clean up allows
      the two existing functions to have separate timeouts and also
      to coexist with its future role of dealing with the "truncate in
      progress" inode flag.
      
      The (pointless) setting of gfs2_quotad_secs is removed since we
      arrange to only wake up quotad when one of the two timers expires.
      
      In addition the struct gfs2_quota_data is moved into a slab cache,
      mainly for easier debugging. It should also be possible to use
      a shrinker in the future, rather than the current scheme of scanning
      the quota data entries from time to time.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      37b2c837
    • Steven Whitehouse's avatar
      GFS2: Add more detail to debugfs glock dumps · fa75cedc
      Steven Whitehouse authored
      Although the glock dumps print quite a lot of information about
      the glocks themselves, there are more things which can be
      usefully added to the dump realting to the objects themselves.
      
      This patch adds a few more fields to the inode and resource
      group lines, which should be useful for debugging.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      fa75cedc
    • Steven Whitehouse's avatar
      GFS2: Banish struct gfs2_rgrpd_host · 73f74948
      Steven Whitehouse authored
      This patch moves the final field so that we can get rid
      of struct gfs2_rgrpd_host, as promised some time ago. Also
      by rearranging the fields slightly, we are able to reduce
      the size of the gfs2_rgrpd structure at the same time.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      73f74948
    • Steven Whitehouse's avatar
      GFS2: Move rg_free from gfs2_rgrpd_host to gfs2_rgrpd · cfc8b549
      Steven Whitehouse authored
      The second of three fields which need to move, in order
      to remove the struct gfs2_rgrpd_host.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      cfc8b549
    • Steven Whitehouse's avatar
      GFS2: Move rg_igeneration into struct gfs2_rgrpd · d8b71f73
      Steven Whitehouse authored
      This moves one of the fields of struct gfs2_rgrpd_host into
      the struct gfs2_rgrpd with the eventual aim of removing
      the struct rgrpd_host completely.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      d8b71f73
    • Steven Whitehouse's avatar
      GFS2: Banish struct gfs2_dinode_host · 383f01fb
      Steven Whitehouse authored
      The final field in gfs2_dinode_host was the i_flags field. Thats
      renamed to i_diskflags in order to avoid confusion with the existing
      inode flags, and moved into the inode proper at a suitable location
      to avoid creating a "hole".
      
      At that point struct gfs2_dinode_host is no longer needed and as
      promised (quite some time ago!) it can now be removed completely.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      383f01fb
    • Steven Whitehouse's avatar
      GFS2: Move i_size from gfs2_dinode_host and rename it to i_disksize · c9e98886
      Steven Whitehouse authored
      This patch moved the i_size field from the gfs2_dinode_host and
      following the ext3 convention renames it i_disksize.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      c9e98886
    • Steven Whitehouse's avatar
      GFS2: Move di_eattr into "proper" inode · 3767ac21
      Steven Whitehouse authored
      This moves the di_eattr field out of gfs2_inode_host and
      into the inode proper.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      3767ac21
    • Steven Whitehouse's avatar
      GFS2: Move "entries" into "proper" inode · ad6203f2
      Steven Whitehouse authored
      This moves the directory entry count into the proper inode.
      Potentially we could get this to share the space used by
      something else in the future, but this is one more step
      on the way to removing the gfs2_dinode_host structure.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      ad6203f2
    • Steven Whitehouse's avatar
      GFS2: Move generation number into "proper" part of inode · bcf0b5b3
      Steven Whitehouse authored
      This moves the generation number from the gfs2_dinode_host
      into the gfs2_inode structure. Eventually the plan is to get
      rid of the gfs2_dinode_host structure completely.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      bcf0b5b3
    • Harvey Harrison's avatar
      GFS2: sparse annotation of gl->gl_spin · 55ba474d
      Harvey Harrison authored
      fs/gfs2/glock.c:308:5: warning: context problem in 'do_promote': '_spin_unlock' expected different context
      fs/gfs2/glock.c:308:5:    context '*gl+28': wanted >= 1, got 0
      fs/gfs2/glock.c:529:2: warning: context problem in 'do_xmote': '_spin_unlock' expected different context
      fs/gfs2/glock.c:529:2:    context '*gl+28': wanted >= 1, got 0
      fs/gfs2/glock.c:925:3: warning: context problem in 'add_to_queue': '_spin_unlock' expected different context
      fs/gfs2/glock.c:925:3:    context '*gl+28': wanted >= 1, got 0
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      55ba474d
    • Steven Whitehouse's avatar
      GFS2: Fix up jdata writepage/delete_inode · 1bb7322f
      Steven Whitehouse authored
      There is a bug in writepage and delete_inode which allows jdata files to
      invalidate pages from the address space without being in a transaction at
      the time. This causes problems in case the pages are in the journal. This
      patch fixes that case and prevents the resulting oops.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      1bb7322f
    • Steven Whitehouse's avatar
      GFS2: Rationalise header files · b2760583
      Steven Whitehouse authored
      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: default avatarSteven Whitehouse <swhiteho@redhat.com>
      b2760583
    • Steven Whitehouse's avatar
      GFS2: Support for FIEMAP ioctl · e9079cce
      Steven Whitehouse authored
      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: default avatarSteven Whitehouse <swhiteho@redhat.com>
      Cc: Theodore Tso <tytso@mit.edu>
      Cc: Eric Sandeen <sandeen@redhat.com>
      e9079cce
    • Linus Torvalds's avatar
      Merge branch 'audit.b61' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current · fe0bdec6
      Linus Torvalds authored
      * 'audit.b61' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
        audit: validate comparison operations, store them in sane form
        clean up audit_rule_{add,del} a bit
        make sure that filterkey of task,always rules is reported
        audit rules ordering, part 2
        fixing audit rule ordering mess, part 1
        audit_update_lsm_rules() misses the audit_inode_hash[] ones
        sanitize audit_log_capset()
        sanitize audit_fd_pair()
        sanitize audit_mq_open()
        sanitize AUDIT_MQ_SENDRECV
        sanitize audit_mq_notify()
        sanitize audit_mq_getsetattr()
        sanitize audit_ipc_set_perm()
        sanitize audit_ipc_obj()
        sanitize audit_socketcall
        don't reallocate buffer in every audit_sockaddr()
      fe0bdec6
  2. 04 Jan, 2009 12 commits