1. 26 Feb, 2010 6 commits
    • Joel Becker's avatar
      ocfs2_dlmfs: Enable the use of user cluster stacks. · cbe0e331
      Joel Becker authored
      
      Unlike ocfs2, dlmfs has no permanent storage.  It can't store off a
      cluster stack it is supposed to be using.  So it can't specify the stack
      name in ocfs2_cluster_connect().
      
      Instead, we create ocfs2_cluster_connect_agnostic(), which simply uses
      the stack that is currently enabled.  This is find for dlmfs, which will
      rely on the stack initialization.
      
      We add the "stackglue" capability to dlmfs's capability list.  This lets
      userspace know dlmfs can be used with all cluster stacks.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      cbe0e331
    • Joel Becker's avatar
      ocfs2: Pass the locking protocol into ocfs2_cluster_connect(). · 553b5eb9
      Joel Becker authored
      
      Inside the stackglue, the locking protocol structure is hanging off of
      the ocfs2_cluster_connection.  This takes it one further; the locking
      protocol is passed into ocfs2_cluster_connect().  Now different cluster
      connections can have different locking protocols with distinct asts.
      Note that all locking protocols have to keep their maximum protocol
      version in lock-step.
      
      With the protocol structure set in ocfs2_cluster_connect(), there is no
      need for the stackglue to have a static pointer to a specific protocol
      structure.  We can change initialization to only pass in the maximum
      protocol version.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      553b5eb9
    • Joel Becker's avatar
      ocfs2: Remove the ast pointers from ocfs2_stack_plugins · e603cfb0
      Joel Becker authored
      
      With the full ocfs2_locking_protocol hanging off of the
      ocfs2_cluster_connection, ast wrappers can get the ast/bast pointers
      there.  They don't need to get them from their plugin structure.
      
      The user plugin still needs the maximum locking protocol version,
      though.  This changes the plugin structure so that it only holds the max
      version, not the entire ocfs2_locking_protocol pointer.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      e603cfb0
    • Joel Becker's avatar
      ocfs2: Hang the locking proto on the cluster conn and use it in asts. · 110946c8
      Joel Becker authored
      
      With the ocfs2_cluster_connection hanging off of the ocfs2_dlm_lksb, we
      have access to it in the ast and bast wrapper functions.  Attach the
      ocfs2_locking_protocol to the conn.
      
      Now, instead of refering to a static variable for ast/bast pointers, the
      wrappers can look at the connection.  This means different connections
      can have different ast/bast pointers, and it reduces the need for the
      static pointer.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      110946c8
    • Joel Becker's avatar
      ocfs2: Attach the connection to the lksb · c0e41338
      Joel Becker authored
      
      We're going to want it in the ast functions, so we convert union
      ocfs2_dlm_lksb to struct ocfs2_dlm_lksb and let it carry the connection.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      c0e41338
    • Joel Becker's avatar
      ocfs2: Pass lksbs back from stackglue ast/bast functions. · a796d286
      Joel Becker authored
      
      The stackglue ast and bast functions tried to maintain the fiction that
      their arguments were void pointers.  In reality, stack_user.c had to
      know that the argument was an ocfs2_lock_res in order to get the status
      off of the lksb.  That's ugly.
      
      This changes stackglue to always pass the lksb as the argument to ast
      and bast functions.  The caller can always use container_of() to get the
      ocfs2_lock_res or user_dlm_lock_res.  The net effect to the caller is
      zero.  They still get back the lockres in their ast.  stackglue gets
      cleaner, and now can use the lksb itself.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      a796d286
  2. 22 Jun, 2009 1 commit
    • Joel Becker's avatar
      ocfs2: Provide the ocfs2_dlm_lvb_valid() stack API. · 1c520dfb
      Joel Becker authored
      
      The Lock Value Block (LVB) of a DLM lock can be lost when nodes die and
      the DLM cannot reconstruct its state.  Clients of the DLM need to know
      this.
      
      ocfs2's internal DLM, o2dlm, explicitly zeroes out the LVB when it loses
      track of the state.  This is not a standard behavior, but ocfs2 has
      always relied on it.  Thus, an o2dlm LVB is always "valid".
      
      ocfs2 now supports both o2dlm and fs/dlm via the stack glue.  When
      fs/dlm loses track of an LVBs state, it sets a flag
      (DLM_SBF_VALNOTVALID) on the Lock Status Block (LKSB).  The contents of
      the LVB may be garbage or merely stale.
      
      ocfs2 doesn't want to try to guess at the validity of the stale LVB.
      Instead, it should be checking the VALNOTVALID flag.  As this is the
      'standard' way of treating LVBs, we will promote this behavior.
      
      We add a stack glue API ocfs2_dlm_lvb_valid().  It returns non-zero when
      the LVB is valid.  o2dlm will always return valid, while fs/dlm will
      check VALNOTVALID.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Acked-by: default avatarMark Fasheh <mfasheh@suse.com>
      1c520dfb
  3. 13 Oct, 2008 1 commit
    • Mark Fasheh's avatar
      ocfs2: POSIX file locks support · 53da4939
      Mark Fasheh authored
      
      This is actually pretty easy since fs/dlm already handles the bulk of the
      work. The Ocfs2 userspace cluster stack module already uses fs/dlm as the
      underlying lock manager, so I only had to add the right calls.
      
      Cluster-aware POSIX locks ("plocks") can be turned off by the same means at
      UNIX locks - mount with 'noflocks', or create a local-only Ocfs2 volume.
      Internally, the file system uses two sets of file_operations, depending on
      whether cluster aware plocks is required. This turns out to be easier than
      implementing local-only versions of ->lock.
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      53da4939
  4. 16 Jun, 2008 3 commits
  5. 18 Apr, 2008 13 commits
    • David Teigland's avatar
      ocfs2: add fsdlm to stackglue · cf4d8d75
      David Teigland authored
      
      Add code to use fs/dlm.
      
      [ Modified to be part of the stack_user module -- Joel ]
      Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      cf4d8d75
    • Joel Becker's avatar
      ocfs2: Add the 'cluster_stack' sysfs file. · 9c6c877c
      Joel Becker authored
      
      Userspace can now query and specify the cluster stack in use via the
      /sys/fs/ocfs2/cluster_stack file.  By default, it is 'o2cb', which is
      the classic stack.  Thus, old tools that do not know how to modify this
      file will work just fine.  The stack cannot be modified if there is a
      live filesystem.
      
      ocfs2_cluster_connect() now takes the expected cluster stack as an
      argument.  This way, the filesystem and the stack glue ensure they are
      speaking to the same backend.
      
      If the stack is 'o2cb', the o2cb stack plugin is used.  For any other
      value, the fsdlm stack plugin is selected.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      9c6c877c
    • Joel Becker's avatar
      ocfs2: Break out stackglue into modules. · 286eaa95
      Joel Becker authored
      
      We define the ocfs2_stack_plugin structure to represent a stack driver.
      The o2cb stack code is split into stack_o2cb.c.  This becomes the
      ocfs2_stack_o2cb.ko module.
      
      The stackglue generic functions are similarly split into the
      ocfs2_stackglue.ko module.  This module now provides an interface to
      register drivers.  The ocfs2_stack_o2cb driver registers itself.  As
      part of this interface, ocfs2_stackglue can load drivers on demand.
      This is accomplished in ocfs2_cluster_connect().
      
      ocfs2_cluster_disconnect() is now notified when a _hangup() is pending.
      If a hangup is pending, it will not release the driver module and will
      let _hangup() do that.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      286eaa95
    • Joel Becker's avatar
      ocfs2: Create ocfs2_stack_operations and split out the o2cb stack. · e3dad42b
      Joel Becker authored
      
      Define the ocfs2_stack_operations structure.  Build o2cb_stack_ops from
      all of the o2cb-specific stack functions.  Change the generic stack glue
      functions to call the stack_ops instead of the o2cb functions directly.
      
      The o2cb functions are moved to stack_o2cb.c.  The headers are cleaned up
      to where only needed headers are included.
      
      In this code, stackglue.c and stack_o2cb.c refer to some shared
      extern variables.  When they become modules, that will change.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      e3dad42b
    • Joel Becker's avatar
      ocfs2: Clean up stackglue initialization · 63e0c48a
      Joel Becker authored
      
      The stack glue initialization function needs a better name so that it can be
      used cleanly when stackglue becomes a module.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      63e0c48a
    • Joel Becker's avatar
      ocfs2: Abstract out a debugging function for underlying dlms. · cf0acdcd
      Joel Becker authored
      
      dlmglue.c was still referencing a raw o2dlm lksb in one instance.  Let's
      create a generic ocfs2_dlm_dump_lksb() function.  This allows underlying
      DLMs to print whatever they want about their lock.
      
      We then move the o2dlm dump into stackglue.c where it belongs.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      cf0acdcd
    • Joel Becker's avatar
      ocfs2: Move o2hb functionality into the stack glue. · 6953b4c0
      Joel Becker authored
      
      The last bit of classic stack used directly in ocfs2 code is o2hb.
      Specifically, the check for heartbeat during mount and the call to
      ocfs2_hb_ctl during unmount.
      
      We create an extra API, ocfs2_cluster_hangup(), to encapsulate the call
      to ocfs2_hb_ctl.  Other stacks will just leave hangup() empty.
      
      The check for heartbeat is moved into ocfs2_cluster_connect().  It will
      be matched by a similar check for other stacks.
      
      With this change, only stackglue.c includes cluster/ headers.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      6953b4c0
    • Joel Becker's avatar
      ocfs2: Abstract out node number queries. · 19fdb624
      Joel Becker authored
      
      ocfs2 asks the cluster stack for the local node's node number for two
      reasons; to fill the slot map and to print it. While the slot map isn't
      necessary for userspace cluster stacks, the printing is very nice for
      debugging. Thus we add ocfs2_cluster_this_node() as a generic API to get
      this value. It is anticipated that the slot map will not be used under a
      userspace cluster stack, so validity checks of the node num only need to
      exist in the slot map code. Otherwise, it just gets used and printed as an
      opaque value.
      
      [ Fixed up some "int" versus "unsigned int" issues and made osb->node_num
        truly opaque. --Mark ]
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      19fdb624
    • Joel Becker's avatar
      ocfs2: Introduce the new ocfs2_cluster_connect/disconnect() API. · 4670c46d
      Joel Becker authored
      
      This step introduces a cluster stack agnostic API for initializing and
      exiting.  fs/ocfs2/dlmglue.c no longer uses o2cb/o2dlm knowledge to
      connect to the stack.  It is all handled in stackglue.c.
      
      heartbeat.c no longer needs to know how it gets called.
      ocfs2_do_node_down() is now a clean recovery trigger.
      
      The big gotcha is the ordering of initializations and de-initializations done
      underneath ocfs2_cluster_connect().  ocfs2_dlm_init() used to do all
      o2dlm initialization in one block.  Thus, the o2dlm functionality of
      ocfs2_cluster_connect() is very straightforward.  ocfs2_dlm_shutdown(),
      however, did a few things between de-registration of the eviction
      callback and actually shutting down the domain.  Now de-registration and
      shutdown of the domain are wrapped within the single
      ocfs2_cluster_disconnect() call.  I've checked the code paths to make
      sure we can safely tear down things in ocfs2_dlm_shutdown() before
      calling ocfs2_cluster_disconnect().  The filesystem has already set
      itself to ignore the callback.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      4670c46d
    • Joel Becker's avatar
      ocfs2: Create the lock status block union. · 8f2c9c1b
      Joel Becker authored
      
      Wrap the lock status block (lksb) in a union.  Later we will add a union
      element for the fs/dlm lksb.  Create accessors for the status and lvb
      fields.
      
      Other than a debugging function, dlmglue.c does not directly reference
      the o2dlm locking path anymore.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      8f2c9c1b
    • Joel Becker's avatar
      ocfs2: Use -errno instead of dlm_status for ocfs2_dlm_lock/unlock() API. · 7431cd7e
      Joel Becker authored
      
      Change the ocfs2_dlm_lock/unlock() functions to return -errno values.
      This is the first step towards elminiating dlm_status in
      fs/ocfs2/dlmglue.c.  The change also passes -errno values to
      ->unlock_ast().
      
      [ Fix a return code in dlmglue.c and change the error translation table into
        an array of ints. --Mark ]
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      7431cd7e
    • Joel Becker's avatar
      ocfs2: Use global DLM_ constants in generic code. · bd3e7610
      Joel Becker authored
      
      The ocfs2 generic code should use the values in <linux/dlmconstants.h>.
      stackglue.c will convert them to o2dlm values.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      bd3e7610
    • Joel Becker's avatar
      ocfs2: Separate out dlm lock functions. · 24ef1815
      Joel Becker authored
      
      This is the first in a series of patches to isolate ocfs2 from the
      underlying cluster stack. Here we wrap the dlm locking functions with
      ocfs2-specific calls. Because ocfs2 always uses the same dlm lock status
      callbacks, we can eliminate the callbacks from the filesystem visible
      functions.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      24ef1815