Permalink
Commits on Nov 18, 2017
  1. nilfs2-kmod7 v1.1.2 release

    konis committed Nov 18, 2017
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  2. README: replace the repository name in examples with nilfs2-kmod7

    konis committed Nov 18, 2017
    We have renamed the repository to "nilfs2-kmod7" from
    "nilfs2-kmod-centos7" (all accesses to the old repo are transferred to
    the new one).  Reflect the change to the README file.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  3. nilfs2: align block comments of nilfs_sufile_truncate_range() at *

    konis committed Nov 17, 2017
    Fix the following checkpatch warning:
    
     WARNING: Block comments should align the * on each line
     #633: FILE: sufile.c:633:
     +/**
     +  * nilfs_sufile_truncate_range - truncate range of segment array
    
    Link: http://lkml.kernel.org/r/1509367935-3086-4-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  4. nilfs2: fix race condition that causes file system corruption

    zeitgeist87 authored and konis committed Nov 17, 2017
    There is a race condition between nilfs_dirty_inode() and
    nilfs_set_file_dirty().
    
    When a file is opened, nilfs_dirty_inode() is called to update the
    access timestamp in the inode.  It calls __nilfs_mark_inode_dirty() in a
    separate transaction.  __nilfs_mark_inode_dirty() caches the ifile
    buffer_head in the i_bh field of the inode info structure and marks it
    as dirty.
    
    After some data was written to the file in another transaction, the
    function nilfs_set_file_dirty() is called, which adds the inode to the
    ns_dirty_files list.
    
    Then the segment construction calls nilfs_segctor_collect_dirty_files(),
    which goes through the ns_dirty_files list and checks the i_bh field.
    If there is a cached buffer_head in i_bh it is not marked as dirty
    again.
    
    Since nilfs_dirty_inode() and nilfs_set_file_dirty() use separate
    transactions, it is possible that a segment construction that writes out
    the ifile occurs in-between the two.  If this happens the inode is not
    on the ns_dirty_files list, but its ifile block is still marked as dirty
    and written out.
    
    In the next segment construction, the data for the file is written out
    and nilfs_bmap_propagate() updates the b-tree.  Eventually the bmap root
    is written into the i_bh block, which is not dirty, because it was
    written out in another segment construction.
    
    As a result the bmap update can be lost, which leads to file system
    corruption.  Either the virtual block address points to an unallocated
    DAT block, or the DAT entry will be reused for something different.
    
    The error can remain undetected for a long time.  A typical error
    message would be one of the "bad btree" errors or a warning that a DAT
    entry could not be found.
    
    This bug can be reproduced reliably by a simple benchmark that creates
    and overwrites millions of 4k files.
    
    Link: http://lkml.kernel.org/r/1509367935-3086-2-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Tested-by: Andreas Rohner <andreas.rohner@gmx.net>
    Tested-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Commits on Jul 23, 2016
  1. nilfs2-kmod7 v1.1.1 release

    konis committed Jul 23, 2016
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Commits on Jul 19, 2016
  1. fs/nilfs2: fix potential underflow in call to crc32_le

    Torsten Hilbrich authored and konis committed Jun 24, 2016
    The value `bytes' comes from the filesystem which is about to be
    mounted.  We cannot trust that the value is always in the range we
    expect it to be.
    
    Check its value before using it to calculate the length for the crc32_le
    call.  It value must be larger (or equal) sumoff + 4.
    
    This fixes a kernel bug when accidentially mounting an image file which
    had the nilfs2 magic value 0x3434 at the right offset 0x406 by chance.
    The bytes 0x01 0x00 were stored at 0x408 and were interpreted as a
    s_bytes value of 1.  This caused an underflow when substracting sumoff +
    4 (20) in the call to crc32_le.
    
      BUG: unable to handle kernel paging request at ffff88021e600000
      IP:  crc32_le+0x36/0x100
      ...
      Call Trace:
        nilfs_valid_sb.part.5+0x52/0x60 [nilfs2]
        nilfs_load_super_block+0x142/0x300 [nilfs2]
        init_nilfs+0x60/0x390 [nilfs2]
        nilfs_mount+0x302/0x520 [nilfs2]
        mount_fs+0x38/0x160
        vfs_kern_mount+0x67/0x110
        do_mount+0x269/0xe00
        SyS_mount+0x9f/0x100
        entry_SYSCALL_64_fastpath+0x16/0x71
    
    Link: http://lkml.kernel.org/r/1466778587-5184-2-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
    Tested-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Commits on May 24, 2016
  1. nilfs2: remove loops of single statement macros

    konis committed May 23, 2016
    This fixes checkpatch.pl warning "WARNING: Single statement macros
    should not use a do {} while (0) loop".
    
    Link: http://lkml.kernel.org/r/1462886671-3521-7-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  2. nilfs2: remove unnecessary else after return or break

    konis committed May 23, 2016
    This fixes the checkpatch.pl warning that suggests else is not
    generally useful after a break or return.
    
    Link: http://lkml.kernel.org/r/1462886671-3521-6-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  3. nilfs2: fix code indent coding style issue

    konis committed May 23, 2016
    This fixes checkpatch.pl warning "WARNING: suspect code indent for
    conditional statements".
    
    Link: http://lkml.kernel.org/r/1462886671-3521-4-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  4. nilfs2: remove space before semicolon

    konis committed May 23, 2016
    This fixes the checkpatch.pl warning "WARNING: space prohibited before
    semicolon" at nilfs_store_magic_and_option().
    
    Link: http://lkml.kernel.org/r/1462886671-3521-3-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  5. nilfs2: do not emit extra newline on nilfs_warning() and nilfs_error()

    konis committed May 23, 2016
    This updates call sites of nilfs_warning() and nilfs_error() so that they
    don't add a duplicate newline.  These output functions are already
    designed to add a trailing newline to the message.
    
    Link: http://lkml.kernel.org/r/1462886671-3521-2-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  6. nilfs2: add missing line spacing

    konis committed May 23, 2016
    Clean up checkpatch.pl warnings "WARNING: Missing a blank line after
    declarations" from nilfs2.
    
    Link: http://lkml.kernel.org/r/1461935747-10380-11-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  7. nilfs2: clean up old e-mail addresses

    konis committed May 23, 2016
    E-mail addresses of osrg.net domain are no longer available.  This
    removes them from authorship notices and prevents reporters from being
    confused.
    
    Link: http://lkml.kernel.org/r/1461935747-10380-5-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  8. nilfs2: remove FSF mailing address from GPL notices

    konis committed May 23, 2016
    This removes the extra paragraph which mentions FSF address in GPL
    notices from source code of nilfs2 and avoids the checkpatch.pl error
    related to it.
    
    Link: http://lkml.kernel.org/r/1461935747-10380-4-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  9. nilfs2: remove space before comma

    konis committed May 23, 2016
    Fix checkpatch.pl error "ERROR: space prohibited before that ','
    (ctx:WxW)" at nilfs_sufile_set_suinfo().
    
    This also fixes checkpatch.pl warning "WARNING: Prefer 'unsigned int' to
    bare use of 'unsigned'" at nilfs_sufile_set_suinfo() and
    nilfs_sufile_get_suinfo().
    
    Link: http://lkml.kernel.org/r/1461935747-10380-3-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Commits on Nov 8, 2015
  1. nilfs2-kmod7 v1.1 release

    konis committed Nov 8, 2015
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  2. nilfs2: free unused dat file blocks during garbage collection

    konis committed Nov 7, 2015
    As a nilfs2 volume ages, the amount of available disk space decreases
    little by little due to bloat of DAT (disk address translation) metadata
    file.  Even if we delete all files in a file system and free their block
    addresses from the DAT file through a garbage collection, empty DAT blocks
    are not freed.
    
    This fixes the issue by extending the deallocator of block addresses so
    that empty data blocks and empty bitmap blocks of DAT are deleted.
    
    The following comparison shows the effect of this patch.  Each shows disk
    amount information of a nilfs2 volume that we cleaned out by deleting all
    files and running gc after having filled 90% of its capacity.
    
    Before:
    Filesystem     1K-blocks     Used Available Use% Mounted on
    /dev/sda1      500105212  3022844 472072192   1% /test
    
    After:
    Filesystem     1K-blocks     Used Available Use% Mounted on
    /dev/sda1      500105212    16380 475078656   1% /test
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  3. nilfs2: add helper functions to delete blocks from dat file

    konis committed Nov 7, 2015
    This adds delete functions for data blocks of metadata files using bitmap
    based allocator.  nilfs_palloc_delete_entry_block() deletes an entry block
    (e.g.  block storing dat entries), and nilfs_palloc_delete_bitmap_block()
    deletes a bitmap block, respectively.
    
    These helpers are intended to be used in the successive change on
    deallocator of block addresses ("nilfs2: free unused dat file blocks
    during garbage collection").
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  4. nilfs2: get rid of nilfs_palloc_group_is_in()

    konis committed Nov 7, 2015
    This unfolds nilfs_palloc_group_is_in() helper function into
    nilfs_palloc_freev() function to simplify a range check and an index
    calculation repeatedy performed in a loop of the function.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  5. nilfs2: refactor nilfs_palloc_find_available_slot()

    konis committed Nov 7, 2015
    The current implementation of nilfs_palloc_find_available_slot() function
    is overkill.  The underlying bit search routine is well optimized, so this
    uses it more simply in nilfs_palloc_find_available_slot().
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  6. nilfs2: do not call nilfs_mdt_bgl_lock() needlessly

    konis committed Nov 7, 2015
    In the bitmap based allocator implementation, nilfs_mdt_bgl_lock() helper
    is frequently used to get a spinlock protecting a target block group.
    This reduces its usage and simplifies arguments of some related functions
    by directly passing a pointer to the spinlock.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  7. nilfs2: use nilfs_warning() in allocator implementation

    konis committed Nov 7, 2015
    This uses nilfs_warning() to replace "printk(KERN_WARNING ...);" in the
    bitmap based allocator implementation of nilfs2.  The warning messages are
    modified to include the device name and the inode number in each message.
    This makes it clear which metadata file of which device has output
    warnings such as "entry number xxxx already freed".
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Commits on Jul 6, 2015
  1. NILFS2: support NFSv2 export

    neilbrown authored and konis committed Jun 25, 2015
    The "fh_len" passed to ->fh_to_* is not guaranteed to be that same as that
    returned by encode_fh - it may be larger.
    
    With NFSv2, the filehandle is fixed length, so it may appear longer than
    expected and be zero-padded.
    
    So we must test that fh_len is at least some value, not exactly equal to
    it.
    
    Signed-off-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Commits on Jun 7, 2015
  1. README: include vanilla kernel 3.6+ to supported versions

    konis committed Jun 7, 2015
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  2. Only call file_update_time() in nilfs_page_mkwrite() for kernel 3.7+

    konis committed Jun 7, 2015
    file_update_time() was moved out from __block_page_mkwrite() in kernel
    3.7.  nilfs_page_mkwrite() doesn't need to call it for kernel 3.6 and
    earlier.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  3. Set VM_CAN_NONLINIEAR to vm_flags in kernel 3.6 and earlier

    konis committed Jun 7, 2015
    VM_CAN_NONLINEAR flag was removed in kernel 3.7.  This adds it for
    kernel 3.6 and earlier to support the earlier kernels.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  4. Fix build error due to addition of vm_ops->remap_pages()

    konis committed Jun 7, 2015
    vm_ops->remap_pages() doesn't exist in kernel 3.6 and earlier.  This
    disables the remap_pages() operation to allow build on the earlier
    kernels.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  5. Fix build failure of nilfs_mapping_init() in kernel 3.7

    konis committed Jun 7, 2015
    "assoc_mapping" member of address_space struct was replaced with a new
    member "private_data" in kernel 3.8.  This supports this change to
    allow build on kernel 3.7.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  6. Add FILEID_INVALID macro

    konis committed Jun 7, 2015
    FILEID_INVALID macro doesn't exist in kernel 3.7 and earlier.  This
    adds it to allow build on the earlier kernels.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  7. Add compat function of wait_for_stable_page()

    konis committed Jun 7, 2015
    wait_for_stable_page() function doesn't exist in kernel 3.8 and
    earlier.  This adds its compat function to allow build on the earlier
    kernels.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  8. Add mimic of MODULE_ALIAS_FS macro

    konis committed Jun 7, 2015
    MODULE_ALIAS_FS macro doesn't exist in kernel 3.8 and earlier.  This
    adds a clone of the macro to allow build for the earlier kernels.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  9. Add compat function of file_inode()

    konis committed Jun 7, 2015
    Kernel 3.8 and earlier don't have file_inode() accessor and this
    hinders build of nilfs2-kmod on these kernels.  This adds a compat
    function of file_inode() to support build on them.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Commits on May 7, 2015
  1. nilfs2: fix sanity check of btree level in nilfs_btree_root_broken()

    konis committed May 5, 2015
    The range check for b-tree level parameter in nilfs_btree_root_broken()
    is wrong; it accepts the case of "level == NILFS_BTREE_LEVEL_MAX" even
    though the level is limited to values in the range of 0 to
    (NILFS_BTREE_LEVEL_MAX - 1).
    
    Since the level parameter is read from storage device and used to index
    nilfs_btree_path array whose element count is NILFS_BTREE_LEVEL_MAX, it
    can cause memory overrun during btree operations if the boundary value
    is set to the level parameter on device.
    
    This fixes the broken sanity check and adds a comment to clarify that
    the upper bound NILFS_BTREE_LEVEL_MAX is exclusive.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Commits on Apr 19, 2015
  1. nilfs2-kmod7 v1.0 release

    konis committed Apr 18, 2015
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  2. README: update versions of supported mainline kernel

    konis committed Apr 19, 2015
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>