01 Mar, 2016

1 commit

  • We need to finish doing the CRC checks before we can allow writes to
    happen, and we currently process the inodes in order. This means a call
    to jffs2_get_ino_cache() for each possible inode# up to c->highest_ino.

    There may be a lot of lookups which fail, if the inode# space is used
    sparsely. And the inode# space is *often* used sparsely, if a file
    system contains a lot of stuff that was put there in the original
    image, followed by lots of creation and deletion of new files.

    Instead of processing them numerically with a lookup each time, just
    walk the hash buckets instead.

    [fix locking typo reported by Dan Carpenter]
    Signed-off-by: David Woodhouse

    David Woodhouse
     

11 Mar, 2014

2 commits

  • We triggered soft-lockup under stress test on 2.6.34 kernel.

    BUG: soft lockup - CPU#1 stuck for 60009ms! [lockf2.test:14488]
    ...
    [] (jffs2_do_reserve_space+0x420/0x440 [jffs2])
    [] (jffs2_reserve_space_gc+0x34/0x78 [jffs2])
    [] (jffs2_garbage_collect_dnode.isra.3+0x264/0x478 [jffs2])
    [] (jffs2_garbage_collect_pass+0x9c0/0xe4c [jffs2])
    [] (jffs2_reserve_space+0x104/0x2a8 [jffs2])
    [] (jffs2_write_inode_range+0x5c/0x4d4 [jffs2])
    [] (jffs2_write_end+0x198/0x2c0 [jffs2])
    [] (generic_file_buffered_write+0x158/0x200)
    [] (__generic_file_aio_write+0x3a4/0x414)
    [] (generic_file_aio_write+0x5c/0xbc)
    [] (do_sync_write+0x98/0xd4)
    [] (vfs_write+0xa8/0x150)
    [] (sys_write+0x3c/0xc0)]

    Fix this by adding a cond_resched() in the while loop.

    [akpm@linux-foundation.org: don't initialize `ret']
    Signed-off-by: Li Zefan
    Cc: David Woodhouse
    Cc: Artem Bityutskiy
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Brian Norris

    Li Zefan
     
  • @wait is a local variable, so if we don't remove it from the wait queue
    list, later wake_up() may end up accessing invalid memory.

    This was spotted by eyes.

    Signed-off-by: Li Zefan
    Cc: David Woodhouse
    Cc: Artem Bityutskiy
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Brian Norris

    Li Zefan
     

18 Nov, 2012

1 commit

  • Users of jffs2_do_reserve_space() expect they still held
    erase_completion_lock after call to it. But there is a path
    where jffs2_do_reserve_space() leaves erase_completion_lock unlocked.
    The patch fixes it.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Alexey Khoroshilov
    Cc: stable@vger.kernel.org
    Signed-off-by: Artem Bityutskiy

    Alexey Khoroshilov
     

14 May, 2012

1 commit

  • Add a new rp_size= parameter which creates a "reserved pool" of disk
    space which can only be used by root. Other users are not permitted
    to write to disk when the available space is less than the pool size.

    Based on original code by Artem Bityutskiy in
    https://dev.laptop.org/ticket/5317

    [dwmw2: use capable(CAP_SYS_RESOURCE) not uid/gid check, fix debug prints]
    Signed-off-by: Daniel Drake
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Daniel Drake
     

27 Mar, 2012

3 commits

  • Use pr_fmt to prefix KBUILD_MODNAME to appropriate logging messages.

    Remove now unnecessary internal prefixes from formats.

    Signed-off-by: Joe Perches
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Joe Perches
     
  • Use the more current logging style.

    Coalesce formats, align arguments.
    Convert uses of embedded function names to %s, __func__.

    A couple of long line checkpatch errors I don't care about exist.

    Signed-off-by: Joe Perches
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Joe Perches
     
  • D1 and D2 macros are mostly uses to emit debugging messages.

    Convert the logging uses of D1 & D2 to jffs2_dbg(level, fmt, ...)
    to be a bit more consistent style with the rest of the kernel.

    All jffs2_dbg output is now at KERN_DEBUG where some of
    the previous uses were emitted at various KERN_s.

    Signed-off-by: Joe Perches
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Joe Perches
     

20 May, 2010

2 commits


19 May, 2010

2 commits

  • Now that we trigger block erases from jffs2_garbage_collect_pass(),
    adjust jffs2_thread_should_wake() to return 1 when there are blocks to
    erase.

    Signed-off-by: Joakim Tjernlund
    Signed-off-by: David Woodhouse

    Joakim Tjernlund
     
  • jffs2_garbage_collect_pass() would previously return -EAGAIN if it
    couldn't find anything to garbage collect from, and there were blocks on
    the erase_pending_list. If the blocks were actually in the process of
    being erased, though, then they wouldn't be on that list. Check for
    nr_erasing_blocks being non-zero instead.

    Fix jffs2_reserve_space() to wait for the in-progress erases to
    complete, when jffs2_garbage_collect_pass() returns -EAGAIN.

    And fix jffs2_erase_succeeded() to actually wake up the erase_wait wq
    that jffs2_reserve_space() is now using.

    Signed-off-by: David Woodhouse

    David Woodhouse
     

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
     

21 Oct, 2008

1 commit


18 Oct, 2008

1 commit

  • After choosing new c->nextblock, don't leave the wbuf offset field
    occasionally pointing at the start of the next physical eraseblock.
    This was causing a BUG() on NOR-ECC (Sibley) flash, where we start
    writing after the cleanmarker.

    Among other this fix should cover write buffer offset adjustment
    after flushing the last page of an eraseblock.

    Signed-off-by: Alexander Belyakov
    Signed-off-by: David Woodhouse

    Alexander Belyakov
     

02 May, 2008

1 commit


23 Apr, 2008

1 commit

  • When _all_ the blocks were on the erase_pending_list, we could't find a
    block to GC from but there was no _actually_ free space, and
    jffs2_reserve_space() would get a little unhappy.

    Handle this case by returning -EAGAIN from jffs2_garbage_collect_pass().
    There are two callers of that function -- jffs2_flush_wbuf_gc(), which
    will interpret it as an error and flush the writebuffer by other means,
    and jffs2_reserve_space(), which we modify to respond to -EAGAIN with an
    immediate call to jffs2_erase_pending_blocks() and another run round the
    loop.

    Signed-off-by: David Woodhouse

    David Woodhouse
     

22 Apr, 2008

2 commits


13 Oct, 2007

1 commit


07 Oct, 2007

1 commit


10 Jul, 2007

1 commit


29 Jun, 2007

1 commit


25 Apr, 2007

1 commit

  • In particular, remove the bit in the LICENCE file about contacting
    Red Hat for alternative arrangements. Their errant IS department broke
    that arrangement a long time ago -- the policy of collecting copyright
    assignments from contributors came to an end when the plug was pulled on
    the servers hosting the project, without notice or reason.

    We do still dual-license it for use with eCos, with the GPL+exception
    licence approved by the FSF as being GPL-compatible. It's just that nobody
    has the right to license it differently.

    Signed-off-by: David Woodhouse

    David Woodhouse
     

18 Apr, 2007

1 commit

  • If a write error occurs, the affected block is placed on the
    bad_used_list. In the case that the write error occured
    when writing summary data the block was also being placed on
    the dirty_list, which caused list corruption and ultimately
    a soft lockup in jffs2_mark_node_obsolete. This fixes that.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Adrian Hunter
     

28 Jun, 2006

1 commit

  • * git://git.infradead.org/mtd-2.6:
    [MTD] NAND: Select chip before checking write protect status
    [MTD] CORE mtdchar.c: fix off-by-one error in lseek()
    [MTD] NAND: Fix typo in mtd/nand/ts7250.c
    [JFFS2][XATTR] coexistence between xattr and write buffering support.
    [JFFS2][XATTR] Fix wrong copyright
    [JFFS2][XATTR] Re-define xd->refcnt as atomic_t
    [JFFS2][XATTR] Fix memory leak with jffs2_xattr_ref
    [JFFS2][XATTR] rid unnecessary writing of delete marker.
    [JFFS2][XATTR] Fix ACL bug when updating null xattr by null ACL.
    [JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion
    [MTD] Fix off-by-one error in physmap.c
    [MTD] Remove unused 'nr_banks' variable from ixp2000 map driver
    [MTD NAND] s3c2412 support in s3c2410.c
    [MTD] Initialize 'writesize'
    [MTD] NAND: ndfc fix address offset thinko
    [MTD] NAND: S3C2410 convert prinks to dev_*()s
    [MTD] NAND: Missing fixups

    Linus Torvalds
     

27 Jun, 2006

2 commits

  • - When xdatum is removed, a new xdatum with 'delete marker' is
    written. (version==0xffffffff means 'delete marker')
    - When xref is removed, a new xref with 'delete marker' is written.
    (odd-numbered xseqno means 'delete marker')

    - delete_xattr_(datum/xref)_delay() are new deletion functions
    are added. We can only use them if we can detect the target
    obsolete xdatum/xref as a orphan or errir one.
    (e.g when inode deletion, or detecting crc error)

    [1/3] jffs2-xattr-v6-01-delete_marker.patch

    Signed-off-by: KaiGai Kohei
    Signed-off-by: David Woodhouse

    KaiGai Kohei
     
  • This patch converts the combination of list_del(A) and list_add(A, B) to
    list_move(A, B) under fs/.

    Cc: Ian Kent
    Acked-by: Joel Becker
    Cc: Neil Brown
    Cc: Hans Reiser
    Cc: Urban Widmark
    Acked-by: David Howells
    Acked-by: Mark Fasheh
    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

19 Jun, 2006

1 commit


27 May, 2006

1 commit


25 May, 2006

2 commits


24 May, 2006

3 commits


23 May, 2006

1 commit


22 May, 2006

2 commits


21 May, 2006

2 commits