09 Jul, 2007

40 commits

  • GFS2 lookup code doesn't ask for inode shared glock. This implies during
    in-memory inode creation for existing file, GFS2 will not disk-read in
    the inode contents. This leaves no_formal_ino un-initialized during
    lookup time. The un-initialized no_formal_ino is subsequently encoded
    into file handle. Clients will get ESTALE error whenever it tries to
    access these files.

    Signed-off-by: S. Wendy Cheng
    Signed-off-by: Steven Whitehouse

    Wendy Cheng
     
  • Cc: Steven Whitehouse
    Signed-off-by: Andrew Morton
    Signed-off-by: Steven Whitehouse

    akpm@linux-foundation.org
     
  • The kernel threads in gfs2, namely gfs2_scand, gfs2_logd, gfs2_quotad,
    gfs2_glockd, gfs2_recoverd weren't doing anything when the suspend
    mechanism was trying to freeze them.

    I put in calls to refrigerator() in the loops for all the daemons and
    suspend works as expected.

    Signed-off-by: Abhijith Das
    Signed-off-by: Steven Whitehouse

    Abhijith Das
     
  • This patch is for bugzilla bug #245663. This crosswrites a fix from
    gfs1 (bz #210369) so that the mount options are reset properly upon
    remount. This was tested on system trin-10.

    Signed-off-by: Bob Peterson
    Signed-off-by: Steven Whitehouse

    Bob Peterson
     
  • 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: S. Wendy Cheng
    Signed-off-by: Steven Whitehouse

    Wendy Cheng
     
  • This patch fixes Red Hat bz#245892

    Opening a tcp connection from a cluster member to another cluster member
    targeting the dlm port it is enough to stop every dlm operation in the cluster.
    This means that GFS and rgmanager will hang.

    Signed-Off-By: Patrick Caulfield
    Signed-off-by: Steven Whitehouse

    Patrick Caulfield
     
  • Code segment inside gfs2_block_truncate_page() doesn't set the return
    code correctly. This causes NFSD erroneously returns EIO back to client
    with setattr procedure call (truncate error).

    Signed-off-by: S. Wendy Cheng
    Signed-off-by: Steven Whitehouse

    S. Wendy Cheng
     
  • This patch is an addendum to the previous journaled file/unmount patch.
    It fixes a problem discovered during testing.

    Signed-off-by: Bob Peterson
    Signed-off-by: Steven Whitehouse

    Robert Peterson
     
  • There is a bug in the code which acquires multiple glocks where if the
    initial out-of-order attempt fails part way though we can land up trying
    to acquire the wrong number of glocks. This is part of the fix for red
    hat bz #239737. The other part of the bz doesn't apply to upstream
    kernels since it was fixed by:

    http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=d3717bdf8f08a0e1039158c8bab2c24d20f492b6

    Since the out-of-order code doesn't appear to add anything to the
    performance of GFS2, this patch just removed it rather than trying to
    fix it. It should be much easier to see whats going on here now. In
    addition, we don't allocate any memory unless we are using a lot of
    glocks (which is a relatively uncommon case).

    Signed-off-by: Steven Whitehouse

    Steven Whitehouse
     
  • This patch passes all my nasty tests that were causing the code to
    fail under one circumstance or another. Here is a complete summary
    of all changes from today's git tree, in order of appearance:

    1. There are now separate variables for metadata buffer accounting.
    2. Variable sd_log_num_hdrs is no longer needed, since the header
    accounting is taken care of by the reserve/refund sequence.
    3. Fixed a tiny grammatical problem in a comment.
    4. Added a new function "calc_reserved" to calculate the reserved
    log space. This isn't entirely necessary, but it has two benefits:
    First, it simplifies the gfs2_log_refund function greatly.
    Second, it allows for easier debugging because I could sprinkle the
    code with calls to this function to make sure the accounting is
    proper (by adding asserts and printks) at strategic point of the code.
    5. In log_pull_tail there apparently was a kludge to fix up the
    accounting based on a "pull" parameter. The buffer accounting is
    now done properly, so the kludge was removed.
    6. File sync operations were making a call to gfs2_log_flush that
    writes another journal header. Since that header was unplanned
    for (reserved) by the reserve/refund sequence, the free space had
    to be decremented so that when log_pull_tail gets called, the free
    space is be adjusted properly. (Did I hear you call that a kludge?
    well, maybe, but a lot more justifiable than the one I removed).
    7. In the gfs2_log_shutdown code, it optionally syncs the log by
    specifying the PULL parameter to log_write_header. I'm not sure
    this is necessary anymore. It just seems to me there could be
    cases where shutdown is called while there are outstanding log
    buffers.
    8. In the (data)buf_lo_before_commit functions, I changed some offset
    values from being calculated on the fly to being constants. That
    simplified some code and we might as well let the compiler do the
    calculation once rather than redoing those cycles at run time.
    9. This version has my rewritten databuf_lo_add function.
    This version is much more like its predecessor, buf_lo_add, which
    makes it easier to understand. Again, this might not be necessary,
    but it seems as if this one works as well as the previous one,
    maybe even better, so I decided to leave it in.
    10. In databuf_lo_before_commit, a previous data corruption problem
    was caused by going off the end of the buffer. The proper solution
    is to have the proper limit in place, rather than stopping earlier.
    (Thus my previous attempt to fix it is wrong).
    If you don't wrap the buffer, you're stopping too early and that
    causes more log buffer accounting problems.
    11. In lops.h there are two new (previously mentioned) constants for
    figuring out the data offset for the journal buffers.
    12. There are also two new functions, buf_limit and databuf_limit to
    calculate how many entries will fit in the buffer.
    13. In function gfs2_meta_wipe, it needs to distinguish between pinned
    metadata buffers and journaled data buffers for proper journal buffer
    accounting. It can't use the JDATA gfs2_inode flag because it's
    sometimes passed the "real" inode and sometimes the "metadata
    inode" and the inode flags will be random bits in a metadata
    gfs2_inode. It needs to base its decision on which was passed in.

    Signed-off-by: Bob Peterson
    Signed-off-by: Steven Whitehouse

    Robert Peterson
     
  • As suggested by Robert P. J. Day

    Signed-off-by: Steven Whitehouse
    Cc: Robert P. J. Day

    Steven Whitehouse
     
  • Not sure how it slipped in, but we don't want it anyway.

    Signed-off-by: Steven Whitehouse

    Steven Whitehouse
     
  • This patch is for bugzilla bug 283162, which uncovered a number of
    bugs pertaining to writing to files that have the journaled bit on.
    These bugs happen most often when writing to the meta_fs because
    the files are always journaled. So operations like gfs2_grow were
    particularly vulnerable, although many of the problems could be
    recreated with normal files after setting the journaled bit on.
    The problems fixed are:

    -GFS2 wasn't ever writing unstuffed journaled data blocks to their
    in-place location on disk. Now it does.

    -If you unmounted too quickly after doing IO to a journaled file,
    GFS2 was crashing because you would discard a buffer whose bufdata
    was still on the active items list. GFS2 now deals with this
    gracefully.

    -GFS2 was losing track of the bufdata for journaled data blocks,
    and it wasn't getting freed, causing an error when you tried to
    unmount the module. GFS2 now frees all the bufdata structures.

    -There was a memory corruption occurring because GFS2 wrote
    twice as many log entries for journaled buffers.

    -It was occasionally trying to write journal headers in buffers
    that weren't currently mapped.

    Signed-off-by: Bob Peterson
    Signed-off-by: Benjamin Marzinski
    Signed-off-by: Steven Whitehouse

    Robert Peterson
     
  • Mask off the recently added DLM_LSFL_FS flag when setting the exflags.
    This way all the nodes in the lockspace aren't required to have the FS
    flag set, since we later check that exflags matches among all nodes.

    Signed-off-by: Patrick Caulfield
    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • There were two issues during deallocation of unlinked inodes. The
    first was relating to the use of a "try" lock which in the case of
    the inode lock wasn't trying hard enough to deallocate in all
    circumstances (now changed to a normal glock) and in the case of
    the iopen lock didn't wait for the demotion of the shared lock before
    attempting to get the exclusive lock, and thereby sometimes (timing dependent)
    not completing the deallocation when it should have done.

    The second issue related to the lack of a way to invalidate dcache entries
    on remote nodes (now fixed by this patch) which meant that unlinks were
    taking a long time to return disk space to the fs. By adding some code to
    invalidate the dcache entries across the cluster for unlinked inodes, that
    is now fixed.

    This patch was written jointly by Abhijith Das and Steven Whitehouse.

    Signed-off-by: Abhijith Das
    Signed-off-by: Steven Whitehouse

    Abhijith Das
     
  • We weren't returning the correct result when GETLK found a conflict,
    which is indicated by userspace passing back a 1.

    Signed-off-by: Abhijith Das
    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • Set the owner field in the plock info sent to userspace for GETLK.
    Without this, gfs_controld won't correctly see when the GETLK from a
    process matches one of the process's existing locks.

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • fs/gfs2/inode.c: In function 'gfs2_lookupi':
    fs/gfs2/inode.c:392: warning: 'error' may be used uninitialized in this function

    Looks like a real bug to me.

    Cc: Steven Whitehouse
    Signed-off-by: Andrew Morton
    Signed-off-by: Steven Whitehouse

    akpm@linux-foundation.org
     
  • Under certain circumstances its possible (though rather unlikely) that
    inodes which were unlinked by one node while still open on another might
    get "lost" in the sense that they don't get deallocated if the node
    which held the inode open crashed before it was unlinked.

    This patch adds the recovery code which allows automatic deallocation of
    the inode if its found during block allocation (the sensible time to
    look for such inodes since we are scanning the rgrp's bitmaps anyway at
    this time, so it adds no overhead to do this).

    Since the inode will have had its i_nlink set to zero, all we need to
    trigger recovery is a lookup and an iput(), and the normal deallocation
    code takes care of the rest.

    Signed-off-by: Steven Whitehouse

    Steven Whitehouse
     
  • This patch fixes bug 243131: Can't mount GFS2 file system on AoE device.
    When using AoE devices with lock_nolock, there is no locking table, so
    gfs2 (and gfs1) uses the superblock s_id. This turns out to be the device
    name in some cases. In the case of AoE, the device contains a slash,
    (e.g. "etherd/e1.1p2") which is an invalid character when we try to
    register the table in sysfs. This patch replaces the "/" with underscore.
    Rather than add a new variable to the stack, I'm just reusing a (char *)
    variable that's no longer used: table.

    This code has been tested on the failing system using a RHEL5 patch.
    The upstream code was tested by using gfs2_tool sb to interject a "/"
    into the table name of a clustered gfs2 file system.

    Signed-off-by: Bob Peterson
    Signed-off-by: Steven Whitehouse

    Robert Peterson
     
  • This fixes a bug in the ordering of operations in the error path of
    createi. Its not valid to do an iput() when holding the inode's glock
    since the iput() will (in this case) result in delete_inode() being
    called which needs to grab the lock itself. This was causing the
    recursive lock checking code to trigger.

    Signed-off-by: Steven Whitehouse

    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: Steven Whitehouse

    Steven Whitehouse
     
  • Add a new flag, DLM_LSFL_FS, to be used when a file system creates a lockspace.
    This flag causes the dlm to use GFP_NOFS for allocations instead of GFP_KERNEL.
    (This updated version of the patch uses gfp_t for ls_allocation.)

    Signed-Off-By: Patrick Caulfield
    Signed-Off-By: David Teigland
    Signed-off-by: Steven Whitehouse

    Patrick Caulfield
     
  • This is a fix for the patch

    021d2ff3a08019260a1dc002793c92d6bf18afb6

    I left off a dlm_hold_rsb which causes the box to panic if you try to use
    debugfs. This patch fixes the problem. Sorry about that,

    Signed-off-by: Josef Bacik
    Signed-off-by: Steven Whitehouse

    Josef Bacik
     
  • 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: Steven Whitehouse

    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: Steven Whitehouse

    Steven Whitehouse
     
  • This is a patch for the first three issues of RHBZ #238162

    The first issue is that when you allocate a new page for a file, it will not
    start off uptodate. This makes sense, since you haven't written anything to that
    part of the file yet. Unfortunately, gfs2_pin() checks to make sure that the
    buffers are uptodate. The solution to this is to mark the buffers uptodate in
    gfs2_commit_write(), after they have been zeroed out and have the data written
    into them. I'm pretty confident with this fix, although it's not completely
    obvious that there is no problem with marking the buffers uptodate here.

    The second issue is simply that you can try to pin a data buffer that is already
    on the incore log, and thus, already pinned. This patch checks to see if this
    buffer is already on the log, and exits databuf_lo_add() if it is, just like
    buf_lo_add() does.

    The third issue is that gfs2_log_flush() doesn't do it's block accounting
    correctly. Both metadata and journaled data are logged, but gfs2_log_flush()
    only compares the number of metadata blocks with the number of blocks to commit
    to the ondisk journal. This patch also counts the journaled data blocks.

    Signed-off-by: Benjamin Marzinski
    Signed-off-by: Steven Whitehouse

    Benjamin Marzinski
     
  • This patch clears the user_data of active sockets as part of cleanup.
    This prevents any late-arriving data from trying to add jobs to the work
    queue while we are tidying up.

    Signed-Off-By: Patrick Caulfield
    Signed-Off-By: David Teigland
    Signed-off-by: Steven Whitehouse

    Patrick Caulfield
     
  • The number of blocks which we reserve in the log at the start of each
    transaction needs to depends upon the block size since the overhead is
    related to the number of "pointers" which can be fitted into a single
    block.

    This relates to Red Hat bz #240435

    Signed-off-by: Steven Whitehouse

    Steven Whitehouse
     
  • This patch fixes a bug where gfs2 was writing update quota usage
    information to the wrong location in the quota file.

    Signed-off-by: Abhijith Das
    Signed-off-by: Steven Whitehouse

    Abhijith Das
     
  • Display the initial value of the "protocol" config value in configfs.
    The default value has always been 0 in the past anyway, so it's always
    appeared to be correct.

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • Add a new debugfs file that dumps a compact list of mastered locks.
    This will be used by a userland daemon to collect state for deadlock
    detection.

    Also, for the existing function that prints all lock state, lock the rsb
    before going through the lock lists since they can be changing in the
    course of normal dlm activity.

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • Add a function that can be used through libdlm by a system daemon to cancel
    another process's deadlocked lock. A completion ast with EDEADLK is returned
    to the process waiting for the lock.

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • Various fixes related to the new timeout feature:
    - add_timeout() missed setting TIMEWARN flag on lkb's when the
    TIMEOUT flag was already set
    - clear_proc_locks should remove a dead process's locks from the
    timeout list
    - the end-of-life calculation for user locks needs to consider that
    ETIMEDOUT is equivalent to -DLM_ECANCEL
    - make initial default timewarn_cs config value visible in configfs
    - change bit position of TIMEOUT_CANCEL flag so it's not copied to
    a remote master node
    - set timestamp on remote lkb's so a lock dump will display the time
    they've been waiting

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • A one liner fix which got missed from the earlier patches.

    Signed-off-by: Steven Whitehouse
    Cc: Fabio Massimo Di Nitto
    Cc: David Teigland

    Steven Whitehouse
     
  • 2e8701a15cd6f7c95e74d6660615a69b09e453ef commit breaks libgfs2 build:

    gcc -Wall -I/usr/src/ubuntu/mypkgs/rhcluster/cluster/config -DHELPER_PROGRAM
    -D_FILE_OFFSET_BITS=64 -DGFS2_RELEASE_NAME=\"2.0\" -ggdb -I/usr/include
    -I../include -I../libgfs2 -c -o gfs2hex.o gfs2hex.c
    In file included from hexedit.h:22,
    from gfs2hex.c:27:
    /usr/include/linux/gfs2_ondisk.h:505: error: expected specifier-qualifier-list
    before ‘u32’
    make[2]: *** [gfs2hex.o] Error 1
    make[2]: Leaving directory `/usr/src/ubuntu/mypkgs/rhcluster/cluster/gfs2/edit'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/usr/src/ubuntu/mypkgs/rhcluster/cluster/gfs2'
    make: *** [gfs2] Error 2

    Signed-off-by: Fabio Massimo Di Nitto
    Signed-off-by: Steven Whitehouse

    Fabio Massimo Di Nitto
     
  • In the rush to get the previous patch set sent, a compilation bug I fixed
    shortly before sending somehow got clobbered, probably by a missed quilt
    refresh or something.

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • Joining the lockspace should wait for the initial round of inter-node
    config checks to complete before returning. This way, if there's a
    configuration mismatch between the joining node and the existing nodes,
    the join can fail and return an error to the application.

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • Fix the error path when exiting new_lockspace(). It was kfree'ing the
    lockspace struct at the end, but that's only valid if it exits before
    kobject_register occured. After kobject_register we have to let the
    kobject do the freeing.

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland
     
  • When conversion deadlock is detected, cancel the conversion and return
    EDEADLK to the application. This is a new default behavior where before
    the dlm would allow the deadlock to exist indefinately.

    The DLM_LKF_NODLCKWT flag can now be used in a conversion to prevent the
    dlm from performing conversion deadlock detection/cancelation on it.
    The DLM_LKF_CONVDEADLK flag can continue to be used as before to tell the
    dlm to demote the granted mode of the lock being converted if it gets into
    a conversion deadlock.

    Signed-off-by: David Teigland
    Signed-off-by: Steven Whitehouse

    David Teigland