10 May, 2011

2 commits


10 Mar, 2011

2 commits


24 Feb, 2011

1 commit

  • Michael Leun reported that running parallel opens on a fuse filesystem
    can trigger a "kernel BUG at mm/truncate.c:475"

    Gurudas Pai reported the same bug on NFS.

    The reason is, unmap_mapping_range() is not prepared for more than
    one concurrent invocation per inode. For example:

    thread1: going through a big range, stops in the middle of a vma and
    stores the restart address in vm_truncate_count.

    thread2: comes in with a small (e.g. single page) unmap request on
    the same vma, somewhere before restart_address, finds that the
    vma was already unmapped up to the restart address and happily
    returns without doing anything.

    Another scenario would be two big unmap requests, both having to
    restart the unmapping and each one setting vm_truncate_count to its
    own value. This could go on forever without any of them being able to
    finish.

    Truncate and hole punching already serialize with i_mutex. Other
    callers of unmap_mapping_range() do not, and it's difficult to get
    i_mutex protection for all callers. In particular ->d_revalidate(),
    which calls invalidate_inode_pages2_range() in fuse, may be called
    with or without i_mutex.

    This patch adds a new mutex to 'struct address_space' to prevent
    running multiple concurrent unmap_mapping_range() on the same mapping.

    [ We'll hopefully get rid of all this with the upcoming mm
    preemptibility series by Peter Zijlstra, the "mm: Remove i_mmap_mutex
    lockbreak" patch in particular. But that is for 2.6.39 ]

    Signed-off-by: Miklos Szeredi
    Reported-by: Michael Leun
    Reported-by: Gurudas Pai
    Tested-by: Gurudas Pai
    Acked-by: Hugh Dickins
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

10 Jan, 2011

2 commits


23 Oct, 2010

10 commits

  • Nilfs now can use sb->s_bdi to get backing_dev_info, so we use it
    instead of ns_bdi on the nilfs object and remove ns_bdi.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This finally removes own inode allocator and destructor functions for
    metadata files. Several routines, nilfs_mdt_new(),
    nilfs_mdt_new_common(), nilfs_mdt_clear(), nilfs_mdt_destroy(), and
    nilfs_alloc_inode_common() will be gone.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • Nilfs object holds a back pointer to a writable super block instance
    in nilfs->ns_writer, and this became eliminable since sb is now made
    per device and all inodes have a valid pointer to it.

    This deletes the ns_writer pointer and a reader/writer semaphore
    protecting it.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This removes a back pointer to nilfs object from nilfs_mdt_info
    structure that is attached to metadata files.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This makes use of iget5_locked to allocate or get inode for metadata
    files to stop using own inode allocator.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This applies prepared rollback function and redirect function of
    metadata file to DAT file, and eliminates GCDAT inode.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • During garbage collection (GC), DAT file, which converts virtual block
    number to real block number, may return disk block number that is not
    yet written to the device.

    To avoid access to unwritten blocks, the current implementation stores
    changes to the caches of GCDAT during GC and atomically commit the
    changes into the DAT file after they are written to the device.

    This patch, instead, adds a function that makes a copy of specified
    buffer and stores it in nilfs_shadow_map, and a function to get the
    backup copy as needed (nilfs_mdt_freeze_buffer and
    nilfs_mdt_get_frozen_buffer respectively).

    Before DAT changes block number in an entry block, it makes a copy and
    redirect access to the buffer so that address conversion function
    (i.e. nilfs_dat_translate) refers to the old address saved in the
    copy.

    This patch gives requisites for such redirection.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This adds optional function to metadata files which makes a copy of
    bmap, page caches, and b-tree node cache, and rolls back to the copy
    as needed.

    This enhancement is intended to displace gcdat inode that provides a
    similar function in a different way.

    In this patch, nilfs_shadow_map structure is added to store a copy of
    the foregoing states. nilfs_mdt_setup_shadow_map relates this
    structure to a metadata file. And, nilfs_mdt_save_to_shadow_map() and
    nilfs_mdt_restore_from_shadow_map() provides save and restore
    functions respectively. Finally, nilfs_mdt_clear_shadow_map() clears
    states of nilfs_shadow_map.

    The copy of b-tree node cache and page cache is made by duplicating
    only dirty pages into corresponding caches in nilfs_shadow_map. Their
    restoration is done by clearing dirty pages from original caches and
    by copying dirty pages back from nilfs_shadow_map.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This separates a part of initialization code of metadata file inode,
    and makes it available from the nilfs iget function that a later patch
    will add to.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The current nilfs_destroy_inode() doesn't handle metadata file inodes
    including gc inodes (dummy inodes used for garbage collection).

    This allows nilfs_destroy_inode() to destroy inodes of metadata files.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

23 Jul, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

20 Nov, 2009

4 commits

  • This adds setup and cleanup routines of the persistent object
    allocator cache.

    According to ftrace analyses, accessing buffers of the DAT file
    suffers indispensable overhead many times. To mitigate the overhead,
    This introduce cache framework for the persistent object allocator
    (palloc) which the DAT file and ifile are using.

    struct nilfs_palloc_cache represents the cache object per metadata
    file using palloc.

    The cache is initialized through nilfs_palloc_setup_cache() and
    destroyed by nilfs_palloc_destroy_cache(); callers of the former
    function will be added to individual allocators of DAT and ifile on
    successive patches.

    nilfs_palloc_destroy_cache() will be called from nilfs_mdt_destroy()
    if the cache is attached to a metadata file. A companion function
    nilfs_palloc_clear_cache() is provided to allow releasing buffer head
    references independently with the cleanup task. This adjunctive
    function will be used before invalidating pages of metadata file with
    the cache.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This turns off readhead action of metadata file if nilfs_mdt_get_block
    function was called with a create flag.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This will hide a function call of nilfs_mdt_clear() in
    nilfs_mdt_destroy().

    This ensures nilfs_mdt_destroy() to do cleanup jobs included in
    nilfs_mdt_clear().

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This adds an optional "object size" argument to nilfs_mdt_new_common()
    function; the argument specifies the size of private object attached
    to a newly allocated metadata file inode.

    This will afford space to keep local variables for meta data files.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

02 Oct, 2009

1 commit


22 Sep, 2009

2 commits


14 Sep, 2009

4 commits

  • The nilfs_bmap_lookup() is now a wrapper function of
    nilfs_bmap_lookup_at_level().

    This moves the nilfs_bmap_lookup() to a header file converting it to
    an inline function and gives an opportunity for optimization.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This gets rid of NILFS_CPFILE_GFP, NILFS_SUFILE_GFP, NILFS_DAT_GFP,
    and NILFS_IFILE_GFP. All of these constants refer to NILFS_MDT_GFP,
    and can be removed.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The current metadata file code skips disk address lookup for its data
    block if the buffer has a mapped flag.

    This has a potential risk to cause read request to be performed
    against the stale block address that GC moved, and it may lead to meta
    data corruption. The mapped flag is safe if the buffer has an
    uptodate flag, otherwise it may prevent necessary update of disk
    address in the next read.

    This will avoid the potential problem by ensuring disk address lookup
    before reading metadata block even for buffers with the mapped flag.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • will get rid of nilfs_get_writer() and nilfs_put_writer() pair used to
    retain a writable FS-instance for a period.

    The pair functions were making up some kind of recursive lock with a
    mutex, but they became overkill since the commit
    201913ed746c7724a40d33ee5a0b6a1fd2ef3193. Furthermore, they caused
    the following lockdep warning because the mutex can be released by a
    task which didn't lock it:

    =====================================
    [ BUG: bad unlock balance detected! ]
    -------------------------------------
    kswapd0/422 is trying to release lock (&nilfs->ns_writer_mutex) at:
    [] mutex_unlock+0x8/0xa
    but there are no more locks to release!

    other info that might help us debug this:
    no locks held by kswapd0/422.

    stack backtrace:
    Pid: 422, comm: kswapd0 Not tainted 2.6.31-rc4-nilfs #51
    Call Trace:
    [] ? printk+0xf/0x18
    [] print_unlock_inbalance_bug+0xcc/0xd7
    [] ? prop_put_global+0x3/0x35
    [] lock_release+0xed/0x1dc
    [] ? mutex_unlock+0x8/0xa
    [] __mutex_unlock_slowpath+0xaf/0x119
    [] mutex_unlock+0x8/0xa
    [] nilfs_mdt_write_page+0xd8/0xe1 [nilfs2]
    [] shrink_page_list+0x379/0x68d
    [] ? isolate_pages_global+0xb4/0x18c
    [] shrink_list+0x26b/0x54b
    [] shrink_zone+0x20c/0x2a2
    [] kswapd+0x407/0x591
    [] ? isolate_pages_global+0x0/0x18c
    [] ? autoremove_wake_function+0x0/0x33
    [] ? kswapd+0x0/0x591
    [] kthread+0x69/0x6e
    [] ? kthread+0x0/0x6e
    [] kernel_thread_helper+0x7/0x1a

    This patch uses a reader/writer semaphore instead of the own lock and
    kills this warning.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

02 Aug, 2009

1 commit


10 Jun, 2009

2 commits


10 May, 2009

1 commit

  • This would fix the following failure during GC:

    nilfs_cpfile_delete_checkpoints: cannot delete block
    NILFS: GC failed during preparation: cannot delete checkpoints: err=-2

    The problem was caused by a break in state consistency between page
    cache and btree; the above block was removed from the btree but the
    page buffering the block was remaining in the page cache in dirty
    state.

    This resolves the inconsistency by ensuring to clear dirty state of
    the page buffering the deleted block.

    Reported-by: David Arendt
    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

09 May, 2009

1 commit

  • This fixes the following circular locking dependency problem:

    =======================================================
    [ INFO: possible circular locking dependency detected ]
    2.6.30-rc3 #5
    -------------------------------------------------------
    segctord/3895 is trying to acquire lock:
    (&nilfs->ns_writer_mutex){+.+...}, at: []
    nilfs_mdt_get_block+0x89/0x20f [nilfs2]

    but task is already holding lock:
    (&bmap->b_sem){++++..}, at: []
    nilfs_bmap_propagate+0x14/0x2e [nilfs2]

    which lock already depends on the new lock.

    The bugfix is done by replacing call sites of nilfs_get_writer() which
    are never called from read-only context with direct dereferencing of
    pointer to a writable FS-instance.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

07 Apr, 2009

3 commits

  • Pekka Enberg advised me:
    > It would be nice if BUG(), BUG_ON(), and panic() calls would be
    > converted to proper error handling using WARN_ON() calls. The BUG()
    > call in nilfs_cpfile_delete_checkpoints(), for example, looks to be
    > triggerable from user-space via the ioctl() system call.

    This will follow the comment and keep them to a minimum.

    Acked-by: Pekka Enberg
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Pekka Enberg pointed out that double error handlings found after
    nilfs_transaction_end() can be avoided by separating abort operation:

    OK, I don't understand this. The only way nilfs_transaction_end() can
    fail is if we have NILFS_TI_SYNC set and we fail to construct the
    segment. But why do we want to construct a segment if we don't commit?

    I guess what I'm asking is why don't we have a separate
    nilfs_transaction_abort() function that can't fail for the erroneous
    case to avoid this double error value tracking thing?

    This does the separation and renames nilfs_transaction_end() to
    nilfs_transaction_commit() for clarification.

    Since, some calls of these functions were used just for exclusion control
    against the segment constructor, they are replaced with semaphore
    operations.

    Acked-by: Pekka Enberg
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • This adds the meta data file, which serves common buffer functions to the
    DAT, sufile, cpfile, ifile, and so forth.

    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi