1. 20 Jan, 2014 2 commits
  2. 19 Jan, 2014 1 commit
  3. 18 Jan, 2014 9 commits
    • Rafael J. Wysocki's avatar
      Revert "ACPI: Add BayTrail SoC GPIO and LPSS ACPI IDs" · 2b844ba7
      Rafael J. Wysocki authored
      This reverts commit f6308b36 (ACPI: Add BayTrail SoC GPIO and LPSS
      ACPI IDs), because it causes the Alan Cox' ASUS T100TA to "crash and
      burn" during boot if the Baytrail pinctrl driver is compiled in.
      
      Fixes: f6308b36 (ACPI: Add BayTrail SoC GPIO and LPSS ACPI IDs)
      Reported-by: default avatarOne Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
      Requested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2b844ba7
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 7d0d46da
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) The value choosen for the new SO_MAX_PACING_RATE socket option on
          parisc was very poorly choosen, let's fix it while we still can.
          From Eric Dumazet.
      
       2) Our generic reciprocal divide was found to handle some edge cases
          incorrectly, part of this is encoded into the BPF as deep as the JIT
          engines themselves.  Just use a real divide throughout for now.
          From Eric Dumazet.
      
       3) Because the initial lookup is lockless, the TCP metrics engine can
          end up creating two entries for the same lookup key.  Fix this by
          doing a second lookup under the lock before we actually create the
          new entry.  From Christoph Paasch.
      
       4) Fix scatter-gather list init in usbnet driver, from Bjørn Mork.
      
       5) Fix unintended 32-bit truncation in cxgb4 driver's bit shifting.
          From Dan Carpenter.
      
       6) Netlink socket dumping uses the wrong socket state for timewait
          sockets.  Fix from Neal Cardwell.
      
       7) Fix netlink memory leak in ieee802154_add_iface(), from Christian
          Engelmayer.
      
       8) Multicast forwarding in ipv4 can overflow the per-rule reference
          counts, causing all multicast traffic to cease.  Fix from Hannes
          Frederic Sowa.
      
       9) via-rhine needs to stop all TX queues when it resets the device,
          from Richard Weinberger.
      
      10) Fix RDS per-cpu accesses broken by the this_cpu_* conversions.  From
          Gerald Schaefer.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
        s390/bpf,jit: fix 32 bit divisions, use unsigned divide instructions
        parisc: fix SO_MAX_PACING_RATE typo
        ipv6: simplify detection of first operational link-local address on interface
        tcp: metrics: Avoid duplicate entries with the same destination-IP
        net: rds: fix per-cpu helper usage
        e1000e: Fix compilation warning when !CONFIG_PM_SLEEP
        bpf: do not use reciprocal divide
        be2net: add dma_mapping_error() check for dma_map_page()
        bnx2x: Don't release PCI bars on shutdown
        net,via-rhine: Fix tx_timeout handling
        batman-adv: fix batman-adv header overhead calculation
        qlge: Fix vlan netdev features.
        net: avoid reference counter overflows on fib_rules in multicast forwarding
        dm9601: add USB IDs for new dm96xx variants
        MAINTAINERS: add virtio-dev ML for virtio
        ieee802154: Fix memory leak in ieee802154_add_iface()
        net: usbnet: fix SG initialisation
        inet_diag: fix inet_diag_dump_icsk() to use correct state for timewait sockets
        cxgb4: silence shift wrapping static checker warning
      7d0d46da
    • Heiko Carstens's avatar
      s390/bpf,jit: fix 32 bit divisions, use unsigned divide instructions · 3af57f78
      Heiko Carstens authored
      The s390 bpf jit compiler emits the signed divide instructions "dr" and "d"
      for unsigned divisions.
      This can cause problems: the dividend will be zero extended to a 64 bit value
      and the divisor is the 32 bit signed value as specified A or X accumulator,
      even though A and X are supposed to be treated as unsigned values.
      
      The divide instrunctions will generate an exception if the result cannot be
      expressed with a 32 bit signed value.
      This is the case if e.g. the dividend is 0xffffffff and the divisor either 1
      or also 0xffffffff (signed: -1).
      
      To avoid all these issues simply use unsigned divide instructions.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3af57f78
    • Eric Dumazet's avatar
      parisc: fix SO_MAX_PACING_RATE typo · 75b99dbd
      Eric Dumazet authored
      SO_MAX_PACING_RATE definition on parisc got a typo.
      Its not too late to fix it, before 3.13 is official.
      
      Fixes: 62748f32 ("net: introduce SO_MAX_PACING_RATE")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      75b99dbd
    • Hannes Frederic Sowa's avatar
      ipv6: simplify detection of first operational link-local address on interface · 11ffff75
      Hannes Frederic Sowa authored
      In commit 1ec047eb ("ipv6: introduce per-interface counter for
      dad-completed ipv6 addresses") I build the detection of the first
      operational link-local address much to complex. Additionally this code
      now has a race condition.
      
      Replace it with a much simpler variant, which just scans the address
      list when duplicate address detection completes, to check if this is
      the first valid link local address and send RS and MLD reports then.
      
      Fixes: 1ec047eb ("ipv6: introduce per-interface counter for dad-completed ipv6 addresses")
      Reported-by: default avatarJiri Pirko <jiri@resnulli.us>
      Cc: Flavio Leitner <fbl@redhat.com>
      Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Acked-by: default avatarFlavio Leitner <fbl@redhat.com>
      Acked-by: default avatarJiri Pirko <jiri@resnulli.us>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11ffff75
    • Christoph Paasch's avatar
      tcp: metrics: Avoid duplicate entries with the same destination-IP · 77f99ad1
      Christoph Paasch authored
      Because the tcp-metrics is an RCU-list, it may be that two
      soft-interrupts are inside __tcp_get_metrics() for the same
      destination-IP at the same time. If this destination-IP is not yet part of
      the tcp-metrics, both soft-interrupts will end up in tcpm_new and create
      a new entry for this IP.
      So, we will have two tcp-metrics with the same destination-IP in the list.
      
      This patch checks twice __tcp_get_metrics(). First without holding the
      lock, then while holding the lock. The second one is there to confirm
      that the entry has not been added by another soft-irq while waiting for
      the spin-lock.
      
      Fixes: 51c5d0c4 (tcp: Maintain dynamic metrics in local cache.)
      Signed-off-by: default avatarChristoph Paasch <christoph.paasch@uclouvain.be>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      77f99ad1
    • Gerald Schaefer's avatar
      net: rds: fix per-cpu helper usage · c196403b
      Gerald Schaefer authored
      commit ae4b46e9 "net: rds: use this_cpu_* per-cpu helper" broke per-cpu
      handling for rds. chpfirst is the result of __this_cpu_read(), so it is
      an absolute pointer and not __percpu. Therefore, __this_cpu_write()
      should not operate on chpfirst, but rather on cache->percpu->first, just
      like __this_cpu_read() did before.
      
      Cc: <stable@vger.kernel.org> # 3.8+
      Signed-off-byd Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c196403b
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace · 48ba620a
      Linus Torvalds authored
      Pull namespace fixes from Eric Biederman:
       "This is a set of 3 regression fixes.
      
        This fixes /proc/mounts when using "ip netns add <netns>" to display
        the actual mount point.
      
        This fixes a regression in clone that broke lxc-attach.
      
        This fixes a regression in the permission checks for mounting /proc
        that made proc unmountable if binfmt_misc was in use.  Oops.
      
        My apologies for sending this pull request so late.  Al Viro gave
        interesting review comments about the d_path fix that I wanted to
        address in detail before I sent this pull request.  Unfortunately a
        bad round of colds kept from addressing that in detail until today.
        The executive summary of the review was:
      
        Al: Is patching d_path really sufficient?
            The prepend_path, d_path, d_absolute_path, and __d_path family of
            functions is a really mess.
      
        Me: Yes, patching d_path is really sufficient.  Yes, the code is mess.
            No it is not appropriate to rewrite all of d_path for a regression
            that has existed for entirely too long already, when a two line
            change will do"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
        vfs: Fix a regression in mounting proc
        fork:  Allow CLONE_PARENT after setns(CLONE_NEWPID)
        vfs: In d_path don't call d_dname on a mount point
      48ba620a
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 8f211b6c
      Linus Torvalds authored
      Pull KVM fix from Paolo Bonzini:
       "Fix for a brown paper bag bug.  Thanks to Drew Jones for noticing"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        kvm: x86: fix apic_base enable check
      8f211b6c
  4. 17 Jan, 2014 3 commits
  5. 16 Jan, 2014 13 commits
  6. 15 Jan, 2014 12 commits
    • Richard Weinberger's avatar
      net,via-rhine: Fix tx_timeout handling · a926592f
      Richard Weinberger authored
      rhine_reset_task() misses to disable the tx scheduler upon reset,
      this can lead to a crash if work is still scheduled while we're resetting
      the tx queue.
      
      Fixes:
      [   93.591707] BUG: unable to handle kernel NULL pointer dereference at 0000004c
      [   93.595514] IP: [<c119d10d>] rhine_napipoll+0x491/0x6
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a926592f
    • Marek Lindner's avatar
      batman-adv: fix batman-adv header overhead calculation · 1df0cbd5
      Marek Lindner authored
      Batman-adv prepends a full ethernet header in addition to its own
      header. This has to be reflected in the MTU calculation, especially
      since the value is used to set dev->hard_header_len.
      
      Introduced by 411d6ed9
      ("batman-adv: consider network coding overhead when calculating required mtu")
      Reported-by: default avatarcmsv <cmsv@wirelesspt.net>
      Reported-by: default avatarMartin Hundebøll <martin@hundeboll.net>
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      1df0cbd5
    • Andrew Jones's avatar
      kvm: x86: fix apic_base enable check · 0dce7cd6
      Andrew Jones authored
      Commit e66d2ae7 moved the assignment
      vcpu->arch.apic_base = value above a condition with
      (vcpu->arch.apic_base ^ value), causing that check
      to always fail. Use old_value, vcpu->arch.apic_base's
      old value, in the condition instead.
      Signed-off-by: default avatarAndrew Jones <drjones@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0dce7cd6
    • Linus Torvalds's avatar
      Merge branch 'akpm' (incoming from Andrew) · 2e67c562
      Linus Torvalds authored
      Merge patches from Andrew Morton:
       "Six fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        lib/percpu_counter.c: fix __percpu_counter_add()
        crash_dump: fix compilation error (on MIPS at least)
        mm: fix crash when using XFS on loopback
        MIPS: fix blast_icache32 on loongson2
        MIPS: fix case mismatch in local_r4k_flush_icache_range()
        nilfs2: fix segctor bug that causes file system corruption
      2e67c562
    • Linus Torvalds's avatar
      Merge tag 'md/3.13-fixes' of git://neil.brown.name/md · 1a60864f
      Linus Torvalds authored
      Pull late md fixes from Neil Brown:
       "Half a dozen md bug fixes.
      
        All of these fix real bugs the people have hit, and are tagged for
        -stable.  Sorry they are late ....  Christmas holidays and all that.
        Hopefully they can still squeak into 3.13"
      
      * tag 'md/3.13-fixes' of git://neil.brown.name/md:
        md: fix problem when adding device to read-only array with bitmap.
        md/raid10: fix bug when raid10 recovery fails to recover a block.
        md/raid5: fix a recently broken BUG_ON().
        md/raid1: fix request counting bug in new 'barrier' code.
        md/raid10: fix two bugs in handling of known-bad-blocks.
        md/raid5: Fix possible confusion when multiple write errors occur.
      1a60864f
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 145830df
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "One nouveau regression fix on older cards, i915 black screen fixes,
        and a revert for a strange G33 intel problem"
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        drm/nouveau: fix null ptr dereferences on some boards
        Revert "drm: copy mode type in drm_mode_connector_list_update()"
        drm/i915/bdw: make sure south port interrupts are enabled properly v2
        drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
        drm/i915: fix DDI PLLs HW state readout code
      145830df
    • Ming Lei's avatar
      lib/percpu_counter.c: fix __percpu_counter_add() · 74e72f89
      Ming Lei authored
      __percpu_counter_add() may be called in softirq/hardirq handler (such
      as, blk_mq_queue_exit() is typically called in hardirq/softirq handler),
      so we need to call this_cpu_add()(irq safe helper) to update percpu
      counter, otherwise counts may be lost.
      
      This fixes the problem that 'rmmod null_blk' hangs in blk_cleanup_queue()
      because of miscounting of request_queue->mq_usage_counter.
      
      This patch is the v1 of previous one of "lib/percpu_counter.c:
      disable local irq when updating percpu couter", and takes Andrew's
      approach which may be more efficient for ARCHs(x86, s390) that
      have optimized this_cpu_add().
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Shaohua Li <shli@fusionio.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Fan Du <fan.du@windriver.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      74e72f89
    • Qais Yousef's avatar
      crash_dump: fix compilation error (on MIPS at least) · 5a610fcc
      Qais Yousef authored
        In file included from kernel/crash_dump.c:2:0:
        include/linux/crash_dump.h:22:27: error: unknown type name `pgprot_t'
      
      when CONFIG_CRASH_DUMP=y
      
      The error was traced back to commit 9cb21813 ("vmcore: introduce
      remap_oldmem_pfn_range()")
      
      include <asm/pgtable.h> to get the missing definition
      Signed-off-by: default avatarQais Yousef <qais.yousef@imgtec.com>
      Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
      Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Cc: <stable@vger.kernel.org>	[3.12+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5a610fcc
    • Mikulas Patocka's avatar
      mm: fix crash when using XFS on loopback · 03e5ac2f
      Mikulas Patocka authored
      Commit 8456a648 ("slab: use struct page for slab management") causes
      a crash in the LVM2 testsuite on PA-RISC (the crashing test is
      fsadm.sh).  The testsuite doesn't crash on 3.12, crashes on 3.13-rc1 and
      later.
      
       Bad Address (null pointer deref?): Code=15 regs=000000413edd89a0 (Addr=000006202224647d)
       CPU: 3 PID: 24008 Comm: loop0 Not tainted 3.13.0-rc6 #5
       task: 00000001bf3c0048 ti: 000000413edd8000 task.ti: 000000413edd8000
      
            YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
       PSW: 00001000000001101111100100001110 Not tainted
       r00-03  000000ff0806f90e 00000000405c8de0 000000004013e6c0 000000413edd83f0
       r04-07  00000000405a95e0 0000000000000200 00000001414735f0 00000001bf349e40
       r08-11  0000000010fe3d10 0000000000000001 00000040829c7778 000000413efd9000
       r12-15  0000000000000000 000000004060d800 0000000010fe3000 0000000010fe3000
       r16-19  000000413edd82a0 00000041078ddbc0 0000000000000010 0000000000000001
       r20-23  0008f3d0d83a8000 0000000000000000 00000040829c7778 0000000000000080
       r24-27  00000001bf349e40 00000001bf349e40 202d66202224640d 00000000405a95e0
       r28-31  202d662022246465 000000413edd88f0 000000413edd89a0 0000000000000001
       sr00-03  000000000532c000 0000000000000000 0000000000000000 000000000532c000
       sr04-07  0000000000000000 0000000000000000 0000000000000000 0000000000000000
      
       IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000401fe42c 00000000401fe430
        IIR: 539c0030    ISR: 00000000202d6000  IOR: 000006202224647d
        CPU:        3   CR30: 000000413edd8000 CR31: 0000000000000000
        ORIG_R28: 00000000405a95e0
        IAOQ[0]: vma_interval_tree_iter_first+0x14/0x48
        IAOQ[1]: vma_interval_tree_iter_first+0x18/0x48
        RP(r2): flush_dcache_page+0x128/0x388
       Backtrace:
         flush_dcache_page+0x128/0x388
         lo_splice_actor+0x90/0x148 [loop]
         splice_from_pipe_feed+0xc0/0x1d0
         __splice_from_pipe+0xac/0xc0
         lo_direct_splice_actor+0x1c/0x70 [loop]
         splice_direct_to_actor+0xec/0x228
         lo_receive+0xe4/0x298 [loop]
         loop_thread+0x478/0x640 [loop]
         kthread+0x134/0x168
         end_fault_vector+0x20/0x28
         xfs_setsize_buftarg+0x0/0x90 [xfs]
      
       Kernel panic - not syncing: Bad Address (null pointer deref?)
      
      Commit 8456a648 changes the page structure so that the slab
      subsystem reuses the page->mapping field.
      
      The crash happens in the following way:
       * XFS allocates some memory from slab and issues a bio to read data
         into it.
       * the bio is sent to the loopback device.
       * lo_receive creates an actor and calls splice_direct_to_actor.
       * lo_splice_actor copies data to the target page.
       * lo_splice_actor calls flush_dcache_page because the page may be
         mapped by userspace.  In that case we need to flush the kernel cache.
       * flush_dcache_page asks for the list of userspace mappings, however
         that page->mapping field is reused by the slab subsystem for a
         different purpose.  This causes the crash.
      
      Note that other architectures without coherent caches (sparc, arm, mips)
      also call page_mapping from flush_dcache_page, so they may crash in the
      same way.
      
      This patch fixes this bug by testing if the page is a slab page in
      page_mapping and returning NULL if it is.
      
      The patch also fixes VM_BUG_ON(PageSlab(page)) that could happen in
      earlier kernels in the same scenario on architectures without cache
      coherence when CONFIG_DEBUG_VM is enabled - so it should be backported
      to stable kernels.
      
      In the old kernels, the function page_mapping is placed in
      include/linux/mm.h, so you should modify the patch accordingly when
      backporting it.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: John David Anglin <dave.anglin@bell.net>]
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Christoph Lameter <cl@linux.com>
      Acked-by: default avatarPekka Enberg <penberg@kernel.org>
      Reviewed-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      03e5ac2f
    • Aaro Koskinen's avatar
      MIPS: fix blast_icache32 on loongson2 · 43a06847
      Aaro Koskinen authored
      Commit 14bd8c08 ("MIPS: Loongson: Get rid of Loongson 2 #ifdefery
      all over arch/mips") failed to add Loongson2 specific blast_icache32
      functions.  Fix that.
      
      The patch fixes the following crash seen with 3.13-rc1:
      
        Reserved instruction in kernel code[#1]:
        [...]
        Call Trace:
          blast_icache32_page+0x8/0xb0
          r4k_flush_cache_page+0x19c/0x200
          do_wp_page.isra.97+0x47c/0xe08
          handle_mm_fault+0x938/0x1118
          __do_page_fault+0x140/0x540
          resume_userspace_check+0x0/0x10
        Code: 00200825  64834000  00200825 <bc900000> bc900020  bc900040  bc900060  bc900080  bc9000a0
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Reviewed-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Acked-by: default avatarJohn Crispin <blogic@openwrt.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      43a06847
    • Huacai Chen's avatar
      MIPS: fix case mismatch in local_r4k_flush_icache_range() · bad009fe
      Huacai Chen authored
      Currently, Loongson-2 call protected_blast_icache_range() and others
      call protected_loongson23_blast_icache_range(), but I think the correct
      behavior should be the opposite.  BTW, Loongson-3's cache-ops is
      compatible with MIPS64, but not compatible with Loongson-2.  So, rename
      xxx_loongson23_yyy things to xxx_loongson2_yyy.
      
      The patch fixes early boot hang with 3.13-rc1, introduced in commit
      14bd8c08 ("MIPS: Loongson: Get rid of Loongson 2 #ifdefery all over
      arch/mips").
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Reviewed-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Acked-by: default avatarJohn Crispin <blogic@openwrt.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bad009fe
    • Andreas Rohner's avatar
      nilfs2: fix segctor bug that causes file system corruption · 70f2fe3a
      Andreas Rohner authored
      There is a bug in the function nilfs_segctor_collect, which results in
      active data being written to a segment, that is marked as clean.  It is
      possible, that this segment is selected for a later segment
      construction, whereby the old data is overwritten.
      
      The problem shows itself with the following kernel log message:
      
        nilfs_sufile_do_cancel_free: segment 6533 must be clean
      
      Usually a few hours later the file system gets corrupted:
      
        NILFS: bad btree node (blocknr=8748107): level = 0, flags = 0x0, nchildren = 0
        NILFS error (device sdc1): nilfs_bmap_last_key: broken bmap (inode number=114660)
      
      The issue can be reproduced with a file system that is nearly full and
      with the cleaner running, while some IO intensive task is running.
      Although it is quite hard to reproduce.
      
      This is what happens:
      
       1. The cleaner starts the segment construction
       2. nilfs_segctor_collect is called
       3. sc_stage is on NILFS_ST_SUFILE and segments are freed
       4. sc_stage is on NILFS_ST_DAT current segment is full
       5. nilfs_segctor_extend_segments is called, which
          allocates a new segment
       6. The new segment is one of the segments freed in step 3
       7. nilfs_sufile_cancel_freev is called and produces an error message
       8. Loop around and the collection starts again
       9. sc_stage is on NILFS_ST_SUFILE and segments are freed
          including the newly allocated segment, which will contain active
          data and can be allocated at a later time
      10. A few hours later another segment construction allocates the
          segment and causes file system corruption
      
      This can be prevented by simply reordering the statements.  If
      nilfs_sufile_cancel_freev is called before nilfs_segctor_extend_segments
      the freed segments are marked as dirty and cannot be allocated any more.
      Signed-off-by: default avatarAndreas Rohner <andreas.rohner@gmx.net>
      Reviewed-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Tested-by: default avatarAndreas Rohner <andreas.rohner@gmx.net>
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      70f2fe3a