04 Jan, 2012

2 commits


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
     

10 May, 2011

2 commits


24 Mar, 2011

1 commit


09 Mar, 2011

1 commit

  • This directly uses sb->s_fs_info to keep a nilfs filesystem object and
    fully removes the intermediate nilfs_sb_info structure. With this
    change, the hierarchy of on-memory structures of nilfs will be
    simplified as follows:

    Before:
    super_block
    -> nilfs_sb_info
    -> the_nilfs
    -> cptree --+-> nilfs_root (current file system)
    +-> nilfs_root (snapshot A)
    +-> nilfs_root (snapshot B)
    :
    -> nilfs_sc_info (log writer structure)
    After:
    super_block
    -> the_nilfs
    -> cptree --+-> nilfs_root (current file system)
    +-> nilfs_root (snapshot A)
    +-> nilfs_root (snapshot B)
    :
    -> nilfs_sc_info (log writer structure)

    The reason why we didn't design so from the beginning is because the
    initial shape also differed from the above. The early hierachy was
    composed of "per-mount-point" super_block -> nilfs_sb_info pairs and a
    shared nilfs object. On the kernel 2.6.37, it was changed to the
    current shape in order to unify super block instances into one per
    device, and this cleanup became applicable as the result.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

08 Mar, 2011

3 commits

  • This is a similar change to those in ext2/ext3 codebase (commit
    40a063f6691ce937 and a4ae3094869f18e2, respectively).

    The addition of 64k block capability in the rec_len_from_disk and
    rec_len_to_disk functions added a bit of math overhead which slows
    down file create workloads needlessly when the architecture cannot
    even support 64k blocks. This will cut the corner.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The current FS_IOC_GETFLAGS/SETFLAGS/GETVERSION will fail if
    application is 32 bit and kernel is 64 bit.

    This issue is avoidable by adding compat_ioctl method.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • Add support for the standard attributes set via chattr and read via
    lsattr. These attributes are already in the flags value in the nilfs2
    inode, but currently we don't have any ioctl commands that expose them
    to the userland.

    Collaterally, this adds the FS_IOC_GETVERSION ioctl for getting
    i_generation, which allows users to list the file's generation number
    with "lsattr -v".

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

10 Jan, 2011

1 commit

  • nilfs_dat_inode function was a wrapper to switch between normal dat
    inode and gcdat, a clone of the dat inode for garbage collection.

    This function got obsolete when the gcdat inode was removed, and now
    we can access the dat inode directly from a nilfs object. So, we will
    unfold the wrapper and remove it.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

16 Dec, 2010

1 commit

  • On 2.6.37-rc1, garbage collection ioctl of nilfs was broken due to the
    commit 263d90cefc7d82a0 ("nilfs2: remove own inode hash used for GC"),
    and leading to filesystem corruption.

    The patch doesn't queue gc-inodes for log writer if they are reused
    through the vfs inode cache. Here, gc-inode is the inode which
    buffers blocks to be relocated on GC. That patch queues gc-inodes in
    nilfs_init_gcinode() function, but this function is not called when
    they don't have I_NEW flag. Thus, some of live blocks are wrongly
    overrode without being moved to new logs.

    This resolves the problem by moving the gc-inode queueing to an outer
    function to ensure it's done right.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

23 Nov, 2010

1 commit


23 Oct, 2010

3 commits

  • Nilfs hasn't supported the freeze/thaw feature because it didn't work
    due to the peculiar design that multiple super block instances could
    be allocated for a device. This limitation was removed by the patch
    "nilfs2: do not allocate multiple super block instances for a device".

    So now this adds the freeze/thaw support to nilfs.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This stops pre-allocating nilfs object in nilfs_get_sb routine, and
    stops managing its life cycle by reference counting.

    nilfs_find_or_create_nilfs() function, nilfs->ns_mount_mutex,
    nilfs_objects list, and the reference counter will be removed through
    the simplification.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This uses inode hash function that vfs provides instead of the own
    hash table for caching gc inodes. This finally removes the own inode
    hash from nilfs.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

05 Oct, 2010

1 commit

  • The BKL is only used in put_super, fill_super and remount_fs that are all
    three protected by the superblocks s_umount rw_semaphore. Therefore it is
    safe to remove the BKL entirely.

    Signed-off-by: Jan Blunck
    Signed-off-by: Arnd Bergmann

    Jan Blunck
     

13 Apr, 2010

1 commit


31 Mar, 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 Feb, 2010

1 commit


13 Feb, 2010

1 commit


25 Dec, 2009

1 commit


13 Nov, 2009

1 commit

  • Will fix the following lock order reversal lockdep detected:

    =======================================================
    [ INFO: possible circular locking dependency detected ]
    2.6.32-rc6 #7
    -------------------------------------------------------
    chcp/30157 is trying to acquire lock:
    (&nilfs->ns_mount_mutex){+.+.+.}, at: [] nilfs_cpfile_change_cpmode+0x46/0x752 [nilfs2]

    but task is already holding lock:
    (&nilfs->ns_segctor_sem){++++.+}, at: [] nilfs_transaction_begin+0xba/0x110 [nilfs2]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #2 (&nilfs->ns_segctor_sem){++++.+}:
    [] __lock_acquire+0x109c/0x139d
    [] lock_acquire+0x89/0xa0
    [] down_read+0x31/0x45
    [] nilfs_attach_checkpoint+0x8f/0x16b [nilfs2]
    [] nilfs_get_sb+0x3e7/0x653 [nilfs2]
    [] vfs_kern_mount+0x8b/0x124
    [] do_kern_mount+0x37/0xc3
    [] do_mount+0x64d/0x69d
    [] sys_mount+0x66/0x95
    [] sysenter_do_call+0x12/0x32

    -> #1 (&type->s_umount_key#31/1){+.+.+.}:
    [] __lock_acquire+0x109c/0x139d
    [] lock_acquire+0x89/0xa0
    [] down_write_nested+0x34/0x52
    [] sget+0x22e/0x389
    [] nilfs_get_sb+0x187/0x653 [nilfs2]
    [] vfs_kern_mount+0x8b/0x124
    [] do_kern_mount+0x37/0xc3
    [] do_mount+0x64d/0x69d
    [] sys_mount+0x66/0x95
    [] sysenter_do_call+0x12/0x32

    -> #0 (&nilfs->ns_mount_mutex){+.+.+.}:
    [] __lock_acquire+0xe27/0x139d
    [] lock_acquire+0x89/0xa0
    [] mutex_lock_nested+0x41/0x23e
    [] nilfs_cpfile_change_cpmode+0x46/0x752 [nilfs2]
    [] nilfs_ioctl+0x11a/0x7da [nilfs2]
    [] vfs_ioctl+0x27/0x6e
    [] do_vfs_ioctl+0x491/0x4db
    [] sys_ioctl+0x45/0x5f
    [] sysenter_do_call+0x12/0x32

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

08 Nov, 2009

2 commits

  • This fixes an -rc1 regression brought by the commit:
    1cf58fa840472ec7df6bf2312885949ebb308853 ("nilfs2: shorten freeze
    period due to GC in write operation v3").

    Although the patch moved out a function call of
    nilfs_ioctl_move_blocks() to nilfs_ioctl_clean_segments() from
    nilfs_ioctl_prepare_clean_segments(), it didn't move corresponding
    cleanup job needed for the error case.

    This will move the missing cleanup job to the destination function.

    Signed-off-by: Ryusuke Konishi
    Acked-by: Jiro SEKIBA

    Ryusuke Konishi
     
  • This fixes a kernel oops reported by Markus Trippelsdorf in the email
    titled "[NILFS users] kernel Oops while running nilfs_cleanerd".

    The oops was caused by a bug of error path in
    nilfs_ioctl_move_blocks() function, which was inlined in
    nilfs_ioctl_clean_segments().

    nilfs_ioctl_move_blocks checks duplication of blocks which will be
    moved in garbage collection. But, the check should have be done
    within nilfs_ioctl_move_inode_block() to prevent list corruption among
    buffers storing the target blocks.

    To fix the kernel oops, this moves forward the duplication check
    before the list insertion.

    I also tested this for stable trees [2.6.30, 2.6.31].

    Reported-by: Markus Trippelsdorf
    Signed-off-by: Ryusuke Konishi
    Cc: stable

    Ryusuke Konishi
     

14 Sep, 2009

1 commit

  • This is a re-revised patch to shorten freeze period.
    This version include a fix of the bug Konishi-san mentioned last time.

    When GC is runnning, GC moves live block to difference segments.
    Copying live blocks into memory is done in a transaction,
    however it is not necessarily to be in the transaction.
    This patch will get the nilfs_ioctl_move_blocks() out from
    transaction lock and put it before the transaction.

    I ran sysbench fileio test against nilfs partition.
    I copied some DVD/CD images and created snapshot to create live blocks
    before starting the benchmark.

    Followings are summary of rc8 and rc8 w/ the patch of per-request
    statistics, which is min/max and avg. I ran each test three times and
    bellow is average of those numers.

    According to this benchmark result, average time is slightly degrated.
    However, worstcase (max) result is significantly improved.
    This can address a few seconds write freeze.

    - random write per-request performance of rc8
    min 0.843ms
    max 680.406ms
    avg 3.050ms
    - random write per-request performance of rc8 w/ this patch
    min 0.843ms -> 100.00%
    max 380.490ms -> 55.90%
    avg 3.233ms -> 106.00%

    - sequential write per-request performance of rc8
    min 0.736ms
    max 774.343ms
    avg 2.883ms
    - sequential write per-request performance of rc8 w/ this patch
    min 0.720ms -> 97.80%
    max 644.280ms-> 83.20%
    avg 3.130ms -> 108.50%

    -----8
    Signed-off-by: Ryusuke Konishi

    Jiro SEKIBA
     

10 Jun, 2009

2 commits

  • Nilfs has some ioctl commands to read out metadata from meta data
    files:

    - NILFS_IOCTL_GET_CPINFO for checkpoint file,
    - NILFS_IOCTL_GET_SUINFO for segment usage file, and
    - NILFS_IOCTL_GET_VINFO for Disk Address Transalation (DAT) file,
    respectively.

    Every routine on these metadata files is implemented so that it allows
    future expansion of on-disk format. But, the above ioctl commands do
    not support expansion even though nilfs_argv structure can handle
    arbitrary size for data exchanged via ioctl.

    This allows future expansion of the following structures which give
    basic format of the "get information" ioctls:

    - struct nilfs_cpinfo
    - struct nilfs_suinfo
    - struct nilfs_vinfo

    So, this introduces forward compatility of such ioctl commands.

    In this patch, a sanity check in nilfs_ioctl_get_info() function is
    changed to accept larger data structure [1], and metadata read
    routines are rewritten so that they become compatible for larger
    structures; the routines will just ignore the remaining fields which
    the current version of nilfs doesn't know.

    [1] The ioctl function already has another upper limit (PAGE_SIZE
    against a structure, which appears in nilfs_ioctl_wrap_copy
    function), and this will not cause security problem.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This will clean up the removal list of segments and the related
    functions from segment.c and ioctl.c, which have hurt code
    readability.

    This elimination is applied by using nilfs_sufile_updatev() previously
    introduced in the patch ("nilfs2: add sufile function that can modify
    multiple segment usages").

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

22 May, 2009

1 commit


12 May, 2009

1 commit

  • Although some ioctls of nilfs2 exchange data in the form of indirectly
    referenced array, some of them lack size check on the array elements.

    This inserts the missing checks and rejects requests if data of ioctl
    does not have a valid format.

    We usually don't have to check size of structures that we associated
    with ioctl commands because the size is tested implicitly for
    identifying ioctl command; the checks this patch adds are for the
    cases where the implicit check is not applied.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

11 May, 2009

2 commits

  • This is a companion patch to ("nilfs2: fix possible circular locking
    for get information ioctls").

    This corrects lock order reversal between mm->mmap_sem and
    nilfs->ns_segctor_sem in nilfs_clean_segments() which was detected by
    lockdep check:

    =======================================================
    [ INFO: possible circular locking dependency detected ]
    2.6.30-rc3-nilfs-00003-g360bdc1 #7
    -------------------------------------------------------
    mmap/5294 is trying to acquire lock:
    (&nilfs->ns_segctor_sem){++++.+}, at: [] nilfs_transaction_begin+0xb6/0x10c [nilfs2]

    but task is already holding lock:
    (&mm->mmap_sem){++++++}, at: [] do_page_fault+0x1d8/0x30a

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&mm->mmap_sem){++++++}:
    [] __lock_acquire+0x1066/0x13b0
    [] lock_acquire+0xba/0xdd
    [] might_fault+0x68/0x88
    [] copy_from_user+0x2a/0x111
    [] nilfs_ioctl_prepare_clean_segments+0x1d/0xf1 [nilfs2]
    [] nilfs_clean_segments+0x6d/0x1b9 [nilfs2]
    [] nilfs_ioctl+0x2ad/0x318 [nilfs2]
    [] vfs_ioctl+0x22/0x69
    [] do_vfs_ioctl+0x460/0x499
    [] sys_ioctl+0x40/0x5a
    [] sysenter_do_call+0x12/0x38
    [] 0xffffffff

    -> #0 (&nilfs->ns_segctor_sem){++++.+}:
    [] __lock_acquire+0xdcc/0x13b0
    [] lock_acquire+0xba/0xdd
    [] down_read+0x2a/0x3e
    [] nilfs_transaction_begin+0xb6/0x10c [nilfs2]
    [] nilfs_page_mkwrite+0xe7/0x154 [nilfs2]
    [] __do_fault+0x165/0x376
    [] handle_mm_fault+0x287/0x5d1
    [] do_page_fault+0x2fb/0x30a
    [] error_code+0x72/0x78
    [] 0xffffffff

    where nilfs_clean_segments() holds:

    nilfs->ns_segctor_sem -> copy_from_user()
    --> page fault -> mm->mmap_sem

    And, page fault path may hold:

    page fault -> mm->mmap_sem
    --> nilfs_page_mkwrite() -> nilfs->ns_segctor_sem

    Even though nilfs_clean_segments() does not perform write access on
    given user pages, it may cause deadlock because nilfs->ns_segctor_sem
    is shared per device and mm->mmap_sem can be shared with other tasks.

    To avoid this problem, this patch moves all calls of copy_from_user()
    outside the nilfs->ns_segctor_sem lock in the ioctl.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This is one of two patches which are to correct possible circular
    locking between mm->mmap_sem and nilfs->ns_segctor_sem.

    The problem was detected by lockdep check as follows:

    =======================================================
    [ INFO: possible circular locking dependency detected ]
    2.6.30-rc3-nilfs-00002-g3552613 #6
    -------------------------------------------------------
    mmap/5418 is trying to acquire lock:
    (&nilfs->ns_segctor_sem){++++.+}, at: [] nilfs_transaction_begin+0xb6/0x10c [nilfs2]

    but task is already holding lock:
    (&mm->mmap_sem){++++++}, at: [] do_page_fault+0x1d8/0x30a

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&mm->mmap_sem){++++++}:
    [] __lock_acquire+0x1066/0x13b0
    [] lock_acquire+0xba/0xdd
    [] might_fault+0x68/0x88
    [] copy_to_user+0x2c/0xfc
    [] nilfs_ioctl_wrap_copy+0x103/0x160 [nilfs2]
    [] nilfs_ioctl+0x30a/0x3b0 [nilfs2]
    [] vfs_ioctl+0x22/0x69
    [] do_vfs_ioctl+0x460/0x499
    [] sys_ioctl+0x40/0x5a
    [] sysenter_do_call+0x12/0x38
    [] 0xffffffff

    -> #0 (&nilfs->ns_segctor_sem){++++.+}:
    [] __lock_acquire+0xdcc/0x13b0
    [] lock_acquire+0xba/0xdd
    [] down_read+0x2a/0x3e
    [] nilfs_transaction_begin+0xb6/0x10c [nilfs2]
    [] nilfs_page_mkwrite+0xe7/0x154 [nilfs2]
    [] __do_fault+0x165/0x376
    [] handle_mm_fault+0x287/0x5d1
    [] do_page_fault+0x2fb/0x30a
    [] error_code+0x72/0x78
    [] 0xffffffff

    other info that might help us debug this:

    1 lock held by mmap/5418:
    #0: (&mm->mmap_sem){++++++}, at: [] do_page_fault+0x1d8/0x30a

    stack backtrace:
    Pid: 5418, comm: mmap Not tainted 2.6.30-rc3-nilfs-00002-g3552613 #6
    Call Trace:
    [] ? printk+0xf/0x12
    [] print_circular_bug_tail+0xaa/0xb5
    [] __lock_acquire+0xdcc/0x13b0
    [] ? nilfs_sufile_get_stat+0x1e/0x105 [nilfs2]
    [] ? up_read+0x16/0x2c
    [] ? nilfs_sufile_get_stat+0xfa/0x105 [nilfs2]
    [] lock_acquire+0xba/0xdd
    [] ? nilfs_transaction_begin+0xb6/0x10c [nilfs2]
    [] down_read+0x2a/0x3e
    [] ? nilfs_transaction_begin+0xb6/0x10c [nilfs2]
    [] nilfs_transaction_begin+0xb6/0x10c [nilfs2]
    [] nilfs_page_mkwrite+0xe7/0x154 [nilfs2]
    [] __do_fault+0x165/0x376
    [] handle_mm_fault+0x287/0x5d1
    [] ? do_page_fault+0x1d8/0x30a
    [] ? down_read_trylock+0x39/0x43
    [] do_page_fault+0x2fb/0x30a
    [] ? do_page_fault+0x0/0x30a
    [] error_code+0x72/0x78
    [] ? do_page_fault+0x0/0x30a

    This makes the lock granularity of nilfs->ns_segctor_sem finer than
    that of the mmap semaphore for ioctl commands except
    nilfs_clean_segments().

    The successive patch ("nilfs2: fix lock order reversal in
    nilfs_clean_segments ioctl") is required to fully resolve the problem.

    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

5 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 suggested converting ->ioctl operations to use
    ->unlocked_ioctl to avoid BKL.

    The conversion was verified to be safe, so I will take it on this
    occasion.

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

    Ryusuke Konishi
     
  • This removes compat code from the nilfs ioctls and applies the same
    function for both .ioctl and .compat_ioctl file operations.

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

    Ryusuke Konishi
     
  • Nilfs ioctl had structures not having fixed sized types such as:

    struct nilfs_argv {
    void *v_base;
    size_t v_nmembs;
    size_t v_size;
    int v_index;
    int v_flags;
    };

    Further, some of them are wrongly aligned:

    e.g.

    struct nilfs_cpmode {
    __u64 cm_cno;
    int cm_mode;
    };

    The size of wrongly aligned structures varies depending on
    architectures, and it breaks the identity of ioctl commands, which
    leads to arch dependent errors.

    Previously, these are compensated by using compat_ioctl.

    This fixes these problems and allows removal of compat ioctl.

    Since this will change sizes of those structures, binary compatibility
    for the past utilities will once break; new utilities have to be used
    instead. However, it would be helpful to avoid platform dependent
    problems in the long term.

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

    Ryusuke Konishi
     
  • This removes NILFS_IOCTL_TIMEDWAIT command from ioctl interface along
    with the related flags and wait queue.

    The command is terrible because it just sleeps in the ioctl. I prefer
    to avoid this by devising means of event polling in userland program.
    By reconsidering the userland GC daemon, I found this is possible
    without changing behaviour of the daemon and sacrificing efficiency.

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

    Ryusuke Konishi