31 Mar, 2008

1 commit


20 Mar, 2008

1 commit

  • Fix a long-standing typo (predating git) that will cause data corruption if a
    journal data block needs unescaping. At the moment the wrong buffer head's
    data is being unescaped.

    To test this case mount a filesystem with data=journal, start creating and
    deleting a bunch of files containing only JBD2_MAGIC_NUMBER (0xc03b3998), then
    pull the plug on the device. Without this patch the files will contain zeros
    instead of the correct data after recovery.

    Signed-off-by: Duane Griffin
    Acked-by: Jan Kara
    Cc:
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Duane Griffin
     

10 Feb, 2008

1 commit

  • In JBD2 jbd2_journal_write_commit_record(), clear the buffer_ordered
    flag for the bh after barried IO has succeed. This prevents later, if
    the same buffer head were submitted to the underlying device, which has
    been reconfigured to not support barrier request, the JBD2 commit code
    could treat it as a normal IO (without barrier).

    This is a port from JBD/ext3 fix from Neil Brown.

    More details from Neil:

    Some devices - notably dm and md - can change their behaviour in
    response to BIO_RW_BARRIER requests. They might start out accepting
    such requests but on reconfiguration, they find out that they cannot
    any more. JBD2 deal with this by always testing if BIO_RW_BARRIER
    requests fail with EOPNOTSUPP, and retrying the write
    requests without the barrier (probably after waiting for any pending
    writes to complete).

    However there is a bug in the handling this in JBD2 for ext4 .

    When ext4/JBD2 to submit a BIO_RW_BARRIER request,
    it sets the buffer_ordered flag on the buffer head.
    If the request completes successfully, the flag STAYS SET.

    Other code might then write the same buffer_head after the device has
    been reconfigured to not accept barriers. This write will then fail,
    but the "other code" is not ready to handle EOPNOTSUPP errors and the
    error will be treated as fatal.

    Cc: Neil Brown
    Signed-off-by: Dave Kleikamp
    Signed-off-by: Mingming Cao
    Signed-off-by: "Theodore Ts'o"

    Dave Kleikamp
     

07 Feb, 2008

1 commit


05 Feb, 2008

3 commits

  • JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT needs to be checked with
    JBD2_HAS_INCOMPAT_FEATURE

    Signed-off-by: Aneesh Kumar K.V
    Signed-off-by: Mingming Cao
    Signed-off-by: "Theodore Ts'o"

    Aneesh Kumar K.V
     
  • With journal checksum patch we added asynchronous commits of journal
    commit headers, and accidentally dropped taking a reference on the
    buffer head.

    (Before the change, sync_dirty_buffer did the get_bh(). The associative
    put_bh is done by journal_wait_on_commit_record().)

    Signed-off-by: Aneesh Kumar K.V
    Signed-off-by: Mingming Cao
    Signed-off-by: "Theodore Ts'o"

    Aneesh Kumar K.V
     
  • The buffer head pointer passed to journal_wait_on_commit_record() could
    be NULL if the previous journal_submit_commit_record() failed or journal
    has already aborted.

    Looking at the jbd2 debug messages, before the oops happened, the jbd2
    is aborted due to trying to access the next log block beyond the end
    of device. This might be caused by using a corrupted image.

    We need to check the error returns from journal_submit_commit_record()
    and avoid calling journal_wait_on_commit_record() in the failure case.

    This addresses Kernel Bugzilla #9849

    Signed-off-by: Mingming Cao
    Signed-off-by: "Theodore Ts'o"

    Mingming Cao
     

30 Jan, 2008

1 commit

  • The break_lock data structure and code for spinlocks is quite nasty.
    Not only does it double the size of a spinlock but it changes locking to
    a potentially less optimal trylock.

    Put all of that under CONFIG_GENERIC_LOCKBREAK, and introduce a
    __raw_spin_is_contended that uses the lock data itself to determine whether
    there are waiters on the lock, to be used if CONFIG_GENERIC_LOCKBREAK is
    not set.

    Rename need_lockbreak to spin_needbreak, make it use spin_is_contended to
    decouple it from the spinlock implementation, and make it typesafe (rwlocks
    do not have any need_lockbreak sites -- why do they even get bloated up
    with that break_lock then?).

    Signed-off-by: Nick Piggin
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Nick Piggin
     

29 Jan, 2008

7 commits

  • Get rid of sparse related warnings from places that use integer as NULL
    pointer. (Ported from upstream ext3/jbd changes.)

    Signed-off-by: Mingming Cao
    Signed-off-by: "Theodore Ts'o"

    Mingming Cao
     
  • While "every 5 seconds" doesn't sound as a problem, there can be many
    of these (and these timers do add up over all the kernel). The "5
    second" wakeup isn't really timing sensitive; in addition even with
    rounding it'll still happen every 5 seconds (with the exception of the
    very first time, which is likely to be rounded up to somewhere closer
    to 6 seconds)

    (Ported from similar JBD patch made by Arjan van de Ven to
    fs/jbd/transaction.c)

    Cc: Arjan van de Ven
    Cc: Andrew Morton
    Signed-off-by: Mingming Cao
    Signed-off-by: "Theodore Ts'o"

    Mingming Cao
     
  • This patch marks slab allocations by jbd2 as short-lived in support of
    Mel Gorman's "Group short-lived and reclaimable kernel allocations"
    patch. (Ported from similar changes made to fs/jbd/journal.c and
    fs/jbd/revoke.c in Mel's patch.)

    Cc: Mel Gorman
    Cc: Andrew Morton
    Signed-off-by: Mingming Cao
    Signed-off-by: "Theodore Ts'o"

    Mingming Cao
     
  • Ported from similar patch for the jbd layer.

    Signed-off-by: Mingming Cao
    Signed-off-by: "Theodore Ts'o"

    Mingming Cao
     
  • The journal checksum feature adds two new flags i.e
    JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT and JBD2_FEATURE_COMPAT_CHECKSUM.

    JBD2_FEATURE_CHECKSUM flag indicates that the commit block contains the
    checksum for the blocks described by the descriptor blocks.
    Due to checksums, writing of the commit record no longer needs to be
    synchronous. Now commit record can be sent to disk without waiting for
    descriptor blocks to be written to disk. This behavior is controlled
    using JBD2_FEATURE_ASYNC_COMMIT flag. Older kernels/e2fsck should not be
    able to recover the journal with _ASYNC_COMMIT hence it is made
    incompat.
    The commit header has been extended to hold the checksum along with the
    type of the checksum.

    For recovery in pass scan checksums are verified to ensure the sanity
    and completeness(in case of _ASYNC_COMMIT) of every transaction.

    Signed-off-by: Andreas Dilger
    Signed-off-by: Girish Shilamkar
    Signed-off-by: Dave Kleikamp
    Signed-off-by: Mingming Cao

    Girish Shilamkar
     
  • The patch below updates the jbd stats patch to 2.6.20/jbd2.
    The initial patch was posted by Alex Tomas in December 2005
    (http://marc.info/?l=linux-ext4&m=113538565128617&w=2).
    It provides statistics via procfs such as transaction lifetime and size.

    Sometimes, investigating performance problems, i find useful to have
    stats from jbd about transaction's lifetime, size, etc. here is a
    patch for review and inclusion probably.

    for example, stats after creation of 3M files in htree directory:

    [root@bob ~]# cat /proc/fs/jbd/sda/history
    R/C tid wait run lock flush log hndls block inlog ctime write drop close
    R 261 8260 2720 0 0 750 9892 8170 8187
    C 259 750 0 4885 1
    R 262 20 2200 10 0 770 9836 8170 8187
    R 263 30 2200 10 0 3070 9812 8170 8187
    R 264 0 5000 10 0 1340 0 0 0
    C 261 8240 3212 4957 0
    R 265 8260 1470 0 0 4640 9854 8170 8187
    R 266 0 5000 10 0 1460 0 0 0
    C 262 8210 2989 4868 0
    R 267 8230 1490 10 0 4440 9875 8171 8188
    R 268 0 5000 10 0 1260 0 0 0
    C 263 7710 2937 4908 0
    R 269 7730 1470 10 0 3330 9841 8170 8187
    R 270 0 5000 10 0 830 0 0 0
    C 265 8140 3234 4898 0
    C 267 720 0 4849 1
    R 271 8630 2740 20 0 740 9819 8170 8187
    C 269 800 0 4214 1
    R 272 40 2170 10 0 830 9716 8170 8187
    R 273 40 2280 0 0 3530 9799 8170 8187
    R 274 0 5000 10 0 990 0 0 0

    where,

    R - line for transaction's life from T_RUNNING to T_FINISHED
    C - line for transaction's checkpointing
    tid - transaction's id
    wait - for how long we were waiting for new transaction to start
    (the longest period journal_start() took in this transaction)
    run - real transaction's lifetime (from T_RUNNING to T_LOCKED
    lock - how long we were waiting for all handles to close
    (time the transaction was in T_LOCKED)
    flush - how long it took to flush all data (data=ordered)
    log - how long it took to write the transaction to the log
    hndls - how many handles got to the transaction
    block - how many blocks got to the transaction
    inlog - how many blocks are written to the log (block + descriptors)
    ctime - how long it took to checkpoint the transaction
    write - how many blocks have been written during checkpointing
    drop - how many blocks have been dropped during checkpointing
    close - how many running transactions have been closed to checkpoint this one

    all times are in msec.

    [root@bob ~]# cat /proc/fs/jbd/sda/info
    280 transaction, each upto 8192 blocks
    average:
    1633ms waiting for transaction
    3616ms running transaction
    5ms transaction was being locked
    1ms flushing data (in ordered mode)
    1799ms logging transaction
    11781 handles per transaction
    5629 blocks per transaction
    5641 logged blocks per transaction

    Signed-off-by: Johann Lombardi
    Signed-off-by: Mariusz Kozlowski
    Signed-off-by: Mingming Cao
    Signed-off-by: Eric Sandeen

    Johann Lombardi
     
  • Before we start committing a transaction, we call
    __journal_clean_checkpoint_list() to cleanup transaction's written-back
    buffers.

    If this call happens to remove all of them (and there were already some
    buffers), __journal_remove_checkpoint() will decide to free the transaction
    because it isn't (yet) a committing transaction and soon we fail some
    assertion - the transaction really isn't ready to be freed :).

    We change the check in __journal_remove_checkpoint() to free only a
    transaction in T_FINISHED state. The locking there is subtle though (as
    everywhere in JBD ;(). We use j_list_lock to protect the check and a
    subsequent call to __journal_drop_transaction() and do the same in the end
    of journal_commit_transaction() which is the only place where a transaction
    can get to T_FINISHED state.

    Probably I'm too paranoid here and such locking is not really necessary -
    checkpoint lists are processed only from log_do_checkpoint() where a
    transaction must be already committed to be processed or from
    __journal_clean_checkpoint_list() where kjournald itself calls it and thus
    transaction cannot change state either. Better be safe if something
    changes in future...

    Signed-off-by: Jan Kara
    Cc:
    Signed-off-by: Andrew Morton

    Jan Kara
     

18 Oct, 2007

6 commits


20 Jul, 2007

2 commits

  • Slab destructors were no longer supported after Christoph's
    c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been
    BUGs for both slab and slub, and slob never supported them
    either.

    This rips out support for the dtor pointer from kmem_cache_create()
    completely and fixes up every single callsite in the kernel (there were
    about 224, not including the slab allocator definitions themselves,
    or the documentation references).

    Signed-off-by: Paul Mundt

    Paul Mundt
     
  • Looking at the current linus-git tree jbd_debug() define in
    include/linux/jbd2.h

    extern u8 journal_enable_debug;

    #define jbd_debug(n, f, a...) \
    do { \
    if ((n) fs/ext4/inode.c: In function ‘ext4_write_inode’:
    > fs/ext4/inode.c:2906: warning: comparison is always true due to limited
    > range of data type
    >
    > fs/jbd2/recovery.c: In function ‘jbd2_journal_recover’:
    > fs/jbd2/recovery.c:254: warning: comparison is always true due to
    > limited range of data type
    > fs/jbd2/recovery.c:257: warning: comparison is always true due to
    > limited range of data type
    >
    > fs/jbd2/recovery.c: In function ‘jbd2_journal_skip_recovery’:
    > fs/jbd2/recovery.c:301: warning: comparison is always true due to
    > limited range of data type
    >
    Noticed all warnings are occurs when the debug level is 0. Then found
    the "jbd2: Move jbd2-debug file to debugfs" patch
    http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0f49d5d019afa4e94253bfc92f0daca3badb990b

    changed the jbd2_journal_enable_debug from int type to u8, makes the
    jbd_debug comparision is always true when the debugging level is 0. Thus
    the compile warning occurs.

    Thought about changing the jbd2_journal_enable_debug data type back to
    int, but can't, because the jbd2-debug is moved to debug fs, where
    calling debugfs_create_u8() to create the debugfs entry needs the value
    to be u8 type.

    Even if we changed the data type back to int, the code is still buggy,
    kernel should not print jbd2 debug message if the
    jbd2_journal_enable_debug is set to 0. But this is not the case.

    The fix is change the level of debugging to 1. The same should fixed in
    ext3/JBD, but currently ext3 jbd-debug via /proc fs is broken, so we
    probably should fix it all together.

    Signed-off-by: Mingming Cao
    Cc: Jeff Garzik
    Cc: Theodore Tso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mingming Cao
     

18 Jul, 2007

2 commits

  • The jbd2-debug file used to be located in /proc/sys/fs/jbd2-debug, but it
    incorrectly used create_proc_entry() instead of the sysctl routines, and
    no proc entry was ever created.

    Instead of fixing this we might as well move the jbd2-debug file to
    debugfs which would be the preferred location for this kind of tunable.
    The new location is now /sys/kernel/debug/jbd2/jbd2-debug.

    Signed-off-by: Jose R. Santos
    Signed-off-by: "Theodore Ts'o"

    Jose R. Santos
     
  • When the JBD code was forked to create the new JBD2 code base, the
    references to CONFIG_JBD_DEBUG where never changed to
    CONFIG_JBD2_DEBUG. This patch fixes that.

    Signed-off-by: Jose R. Santos
    Signed-off-by: "Theodore Ts'o"

    Jose R. Santos
     

17 Jul, 2007

2 commits

  • Replace (n & (n-1)) in the context of power of 2 checks with
    is_power_of_2().

    Signed-off-by: vignesh babu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    vignesh babu
     
  • We have to check that also the second checkpoint list is non-empty before
    dropping the transaction.

    Signed-off-by: Jan Kara
    Cc: Chuck Ebbert
    Cc: Kirill Korotaev
    Cc:
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     

09 May, 2007

3 commits


08 Dec, 2006

4 commits

  • In the current jbd code, if a buffer on BJ_SyncData list is dirty and not
    locked, the buffer is refiled to BJ_Locked list, submitted to the IO and
    waited for IO completion.

    But the fsstress test showed the case that when a buffer was already
    submitted to the IO just before the buffer_dirty(bh) check, the buffer was
    not waited for IO completion.

    Following patch solves this problem. If it is assumed that a buffer is
    submitted to the IO before the buffer_dirty(bh) check and still being
    written to disk, this buffer is refiled to BJ_Locked list.

    Signed-off-by: Hisashi Hifumi
    Cc: Jan Kara
    Cc: "Stephen C. Tweedie"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hisashi Hifumi
     
  • Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • Move process freezing functions from include/linux/sched.h to freezer.h, so
    that modifications to the freezer or the kernel configuration don't require
    recompiling just about everything.

    [akpm@osdl.org: fix ueagle driver]
    Signed-off-by: Nigel Cunningham
    Cc: "Rafael J. Wysocki"
    Cc: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nigel Cunningham
     
  • Replace all uses of kmem_cache_t with struct kmem_cache.

    The patch was generated using the following script:

    #!/bin/sh
    #
    # Replace one string by another in all the kernel sources.
    #

    set -e

    for file in `find * -name "*.c" -o -name "*.h"|xargs grep -l $1`; do
    quilt add $file
    sed -e "1,\$s/$1/$2/g" $file >/tmp/$$
    mv /tmp/$$ $file
    quilt refresh
    done

    The script was run like this

    sh replace kmem_cache_t "struct kmem_cache"

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

29 Oct, 2006

1 commit

  • When running several fsx's and other filesystem stress tests, we found
    cases where an unmapped buffer was still being sent to submit_bh by the
    ext3 dirty data journaling code.

    I saw this happen in two ways, both related to another thread doing a
    truncate which would unmap the buffer in question.

    Either we would get into journal_dirty_data with a bh which was already
    unmapped (although journal_dirty_data_fn had checked for this earlier, the
    state was not locked at that point), or it would get unmapped in the middle
    of journal_dirty_data when we dropped locks to call sync_dirty_buffer.

    By re-checking for mapped state after we've acquired the bh state lock, we
    should avoid these races. If we find a buffer which is no longer mapped,
    we essentially ignore it, because journal_unmap_buffer has already decided
    that this buffer can go away.

    I've also added tracepoints in these two cases, and made a couple other
    tracepoint changes that I found useful in debugging this.

    Signed-off-by: Eric Sandeen
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     

21 Oct, 2006

1 commit

  • A disk generated some I/O error, after it, I hitted
    J_ASSERT(transaction->t_updates > 0) in journal_stop().

    It seems to happened on ext3_truncate() path from stack trace. Then,
    maybe the following case may trigger J_ASSERT(transaction->t_updates > 0).

    ext3_truncate()
    -> ext3_free_branches()
    -> ext3_journal_test_restart()
    -> ext3_journal_restart()
    -> journal_restart()
    transaction->t_updates--;
    /* another process aborted journal */
    -> start_this_handle()
    returns -EROFS without transaction->t_updates++;

    -> ext3_journal_stop()
    -> journal_stop()
    J_ASSERT(transaction->t_updates > 0)

    If journal was aborted in middle of journal_restart(), ext3_truncate()
    may trigger J_ASSERT().

    Signed-off-by: OGAWA Hirofumi
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

17 Oct, 2006

1 commit

  • This is Eric Sesterhenn's jbd patch applied to jbd2.
    Commit: 41716c7c21b15e7ecf14f0caf1eef3980707fb74

    His words:

    Since commit d1807793e1e7e502e3dc047115e9dbc3b50e4534 we dereference a NULL
    pointer. Coverity id #1432. We set journal to NULL, and use it directly
    afterwards.

    Signed-off-by: Dave Kleikamp
    Cc: Eric Sesterhenn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Kleikamp
     

12 Oct, 2006

3 commits

  • Similar to ext4, change blocks in JBD2 from sector_t to unsigned long long.

    Signed-off-by: Mingming Cao
    Signed-off-by: Dave Kleikamp
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mingming Cao
     
  • JBD layer in-kernel block varibles type fixes to support >32 bit block number
    and convert to sector_t type.

    Signed-off-by: Mingming Cao
    Signed-off-by: Dave Kleikamp
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mingming Cao
     
  • Here is the patch to JBD to handle 64 bit block numbers, originally from Zach
    Brown. This patch is useful only after adding support for 64-bit block
    numbers in the filesystem.

    Signed-off-by: Badari Pulavarty
    Signed-off-by: Zach Brown
    Signed-off-by: Dave Kleikamp
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zach Brown