21 Dec, 2011

2 commits

  • There is a potential integer overflow in nilfs_ioctl_clean_segments().
    When a large argv[n].v_nmembs is passed from the userspace, the subsequent
    call to vmalloc() will allocate a buffer smaller than expected, which
    leads to out-of-bound access in nilfs_ioctl_move_blocks() and
    lfs_clean_segments().

    The following check does not prevent the overflow because nsegs is also
    controlled by the userspace and could be very large.

    if (argv[n].v_nmembs > nsegs * nilfs->ns_blocks_per_segment)
    goto out_free;

    This patch clamps argv[n].v_nmembs to UINT_MAX / argv[n].v_size, and
    returns -EINVAL when overflow.

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

    Haogang Chen
     
  • commit 828b1c50ae ("nilfs2: add compat ioctl") incidentally broke all
    other NILFS compat ioctls. Make them work again.

    Signed-off-by: Thomas Meyer
    Signed-off-by: Ryusuke Konishi
    Tested-by: Ryusuke Konishi
    Cc: [3.0+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Meyer
     

02 Nov, 2011

2 commits


01 Nov, 2011

1 commit

  • Standardize the style for compiler based printf format verification.
    Standardized the location of __printf too.

    Done via script and a little typing.

    $ grep -rPl --include=*.[ch] -w "__attribute__" * | \
    grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
    xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'

    [akpm@linux-foundation.org: revert arch bits]
    Signed-off-by: Joe Perches
    Cc: "Kirill A. Shutemov"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

21 Jul, 2011

3 commits

  • Btrfs needs to be able to control how filemap_write_and_wait_range() is called
    in fsync to make it less of a painful operation, so push down taking i_mutex and
    the calling of filemap_write_and_wait() down into the ->fsync() handlers. Some
    file systems can drop taking the i_mutex altogether it seems, like ext3 and
    ocfs2. For correctness sake I just pushed everything down in all cases to make
    sure that we keep the current behavior the same for everybody, and then each
    individual fs maintainer can make up their mind about what to do from there.
    Thanks,

    Acked-by: Jan Kara
    Signed-off-by: Josef Bacik
    Signed-off-by: Al Viro

    Josef Bacik
     
  • Simple filesystems always pass inode->i_sb_bdev as the block device
    argument, and never need a end_io handler. Let's simply things for
    them and for my grepping activity by dropping these arguments. The
    only thing not falling into that scheme is ext4, which passes and
    end_io handler without needing special flags (yet), but given how
    messy the direct I/O code there is use of __blockdev_direct_IO
    in one instead of two out of three cases isn't going to make a large
    difference anyway.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • Let filesystems handle waiting for direct I/O requests themselves instead
    of doing it beforehand. This means filesystem-specific locks to prevent
    new dio referenes from appearing can be held. This is important to allow
    generalizing i_dio_count to non-DIO_LOCKING filesystems.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

20 Jul, 2011

4 commits


20 Jun, 2011

1 commit


11 Jun, 2011

3 commits

  • Checkpoint generation interval of nilfs goes wrong after user has
    changed the interval parameter with nilfs-tune tool.

    segctord starting. Construction interval = 5 seconds,
    CP frequency < 30 seconds
    segctord starting. Construction interval = 0 seconds,
    CP frequency < 30 seconds

    This turned out to be caused by a trivial bug in initialization code
    of log writer. This will fix it.

    Reported-by: Andrea Gelmini
    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • nilfs_btree_delete function does not terminate part of virtual block
    addresses when shrinking the last remaining child node into the root
    node. The missing address termination causes that dead btree node
    blocks persist and chip away free disk space.

    This fixes the leak bug on the btree node deletion.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • nilfs_btree_delete function wrongly terminates virtual block address
    of the btree node held by its parent at index 0. When concatenating
    the index-0 node with its right sibling node, nilfs_btree_delete
    terminates the block address of index-0 node instead of the right
    sibling node which should be deleted.

    This bug not only wears disk space in the long run, but also causes
    file system corruption. This will fix it.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

28 May, 2011

1 commit


27 May, 2011

2 commits

  • Tell the filesystem if we just updated timestamp (I_DIRTY_SYNC) or
    anything else, so that the filesystem can track internally if it
    needs to push out a transaction for fdatasync or not.

    This is just the prototype change with no user for it yet. I plan
    to push large XFS changes for the next merge window, and getting
    this trivial infrastructure in this window would help a lot to avoid
    tree interdependencies.

    Also remove incorrect comments that ->dirty_inode can't block. That
    has been changed a long time ago, and many implementations rely on it.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (25 commits)
    cifs: remove unnecessary dentry_unhash on rmdir/rename_dir
    ocfs2: remove unnecessary dentry_unhash on rmdir/rename_dir
    exofs: remove unnecessary dentry_unhash on rmdir/rename_dir
    nfs: remove unnecessary dentry_unhash on rmdir/rename_dir
    ext2: remove unnecessary dentry_unhash on rmdir/rename_dir
    ext3: remove unnecessary dentry_unhash on rmdir/rename_dir
    ext4: remove unnecessary dentry_unhash on rmdir/rename_dir
    btrfs: remove unnecessary dentry_unhash in rmdir/rename_dir
    ceph: remove unnecessary dentry_unhash calls
    vfs: clean up vfs_rename_other
    vfs: clean up vfs_rename_dir
    vfs: clean up vfs_rmdir
    vfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems
    libfs: drop unneeded dentry_unhash
    vfs: update dentry_unhash() comment
    vfs: push dentry_unhash on rename_dir into file systems
    vfs: push dentry_unhash on rmdir into file systems
    vfs: remove dget() from dentry_unhash()
    vfs: dentry_unhash immediately prior to rmdir
    vfs: Block mmapped writes while the fs is frozen
    ...

    Linus Torvalds
     

26 May, 2011

2 commits


10 May, 2011

14 commits


06 Apr, 2011

1 commit

  • With the ->sync_page() hook gone, we have a few users that
    add their own static address_space_operations without any
    functions defined.

    fs/inode.c already has an empty_aops that it uses for init
    purposes. Lets export that and use it in the places where
    an otherwise empty aops was defined.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

30 Mar, 2011

3 commits

  • Fixes whitespace coding style issues.

    Signed-off-by: Nicolas Kaiser
    Signed-off-by: Ryusuke Konishi

    Nicolas Kaiser
     
  • Nilfs in 2.6.39-rc1 hit the following oops:

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000048
    IP: [] try_to_release_page+0x2a/0x3d
    PGD 234cb6067 PUD 234c72067 PMD 0
    Oops: 0000 [#1] SMP

    Process truncate (pid: 10995, threadinfo ffff8802353c2000, task ffff880234cfa000)
    Stack:
    ffff8802333c77b8 ffffffff810b64b0 0000000000003802 ffffffffa0052cca
    0000000000000000 ffff8802353c3b58 0000000000000000 ffff8802353c3b58
    0000000000000001 0000000000000000 ffffea0007b92308 ffffea0007b92308
    Call Trace:
    [] ? invalidate_inode_pages2_range+0x15f/0x273
    [] ? nilfs_palloc_get_block+0x2d/0xaf [nilfs2]
    [] ? bit_waitqueue+0x14/0xa1
    [] ? wake_up_bit+0x10/0x20
    [] ? nilfs_forget_buffer+0x66/0x7a [nilfs2]
    [] ? nilfs_btree_concat_left+0x5c/0x77 [nilfs2]
    [] ? nilfs_btree_delete+0x395/0x3cf [nilfs2]
    [] ? nilfs_bmap_do_delete+0x6e/0x79 [nilfs2]
    [] ? nilfs_btree_last_key+0x14b/0x15e [nilfs2]
    [] ? nilfs_bmap_truncate+0x2f/0x83 [nilfs2]
    [] ? nilfs_bmap_last_key+0x35/0x62 [nilfs2]
    [] ? nilfs_truncate_bmap+0x6b/0xc7 [nilfs2]
    [] ? nilfs_truncate+0x79/0xe4 [nilfs2]
    [] ? vmtruncate+0x33/0x3b
    [] ? nilfs_setattr+0x4d/0x8c [nilfs2]
    [] ? do_page_fault+0x31b/0x356
    [] ? notify_change+0x17d/0x262
    [] ? do_truncate+0x65/0x80
    [] ? sys_ftruncate+0xf1/0xf6
    [] ? system_call_fastpath+0x16/0x1b
    Code: c3 48 83 ec 08 48 8b 17 48 8b 47 18 80 e2 01 75 04 0f 0b eb fe 48 8b 17 80 e6 20 74 05 31 c0 41 59 c3 48 85 c0 74 11 48 8b 40 58
    8b 40 48 48 85 c0 74 04 41 58 ff e0 59 e9 b1 b5 05 00 41 54
    RIP [] try_to_release_page+0x2a/0x3d
    RSP
    CR2: 0000000000000048

    This oops was brought in by the change "block: remove per-queue
    plugging" (commit: 7eaceaccab5f40bb). It initializes mapping->a_ops
    with a NULL pointer for some pages in nilfs (e.g. btree node pages),
    but mm code doesn't NULL pointer checks against mapping->a_ops. (the
    check is done for each callback function)

    This corrects the aops initialization and fixes the oops.

    Signed-off-by: Ryusuke Konishi
    Acked-by: Jens Axboe

    Ryusuke Konishi
     
  • From the result of a function test of mmap, mmap write to shared pages
    turned out to be broken for hole blocks. It doesn't write out filled
    blocks and the data will be lost after umount. This is due to a bug
    that the target file is not queued for log writer when filling hole
    blocks.

    Also, nilfs_page_mkwrite function exits normal code path even after
    successfully filled hole blocks due to a change of block_page_mkwrite
    function; just after nilfs was merged into the mainline,
    block_page_mkwrite() started to return VM_FAULT_LOCKED instead of zero
    by the patch "mm: close page_mkwrite races" (commit:
    b827e496c893de0c). The current nilfs_page_mkwrite() is not handling
    this value properly.

    This corrects nilfs_page_mkwrite() and will resolve the data loss
    problem in mmap write.

    [This should be applied to every kernel since 2.6.30 but a fix is
    needed for 2.6.37 and prior kernels]

    Signed-off-by: Ryusuke Konishi
    Tested-by: Ryusuke Konishi
    Cc: stable [2.6.38]

    Ryusuke Konishi
     

25 Mar, 2011

1 commit

  • * 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block: (65 commits)
    Documentation/iostats.txt: bit-size reference etc.
    cfq-iosched: removing unnecessary think time checking
    cfq-iosched: Don't clear queue stats when preempt.
    blk-throttle: Reset group slice when limits are changed
    blk-cgroup: Only give unaccounted_time under debug
    cfq-iosched: Don't set active queue in preempt
    block: fix non-atomic access to genhd inflight structures
    block: attempt to merge with existing requests on plug flush
    block: NULL dereference on error path in __blkdev_get()
    cfq-iosched: Don't update group weights when on service tree
    fs: assign sb->s_bdi to default_backing_dev_info if the bdi is going away
    block: Require subsystems to explicitly allocate bio_set integrity mempool
    jbd2: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explicit plugging
    jbd: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explicit plugging
    fs: make fsync_buffers_list() plug
    mm: make generic_writepages() use plugging
    blk-cgroup: Add unaccounted time to timeslice_used.
    block: fixup plugging stubs for !CONFIG_BLOCK
    block: remove obsolete comments for blkdev_issue_zeroout.
    blktrace: Use rq->cmd_flags directly in blk_add_trace_rq.
    ...

    Fix up conflicts in fs/{aio.c,super.c}

    Linus Torvalds