Skip to content
  1. Oct 21, 2019
  2. Oct 18, 2019
    • Dave Chinner's avatar
      iomap: iomap that extends beyond EOF should be marked dirty · 7684e2c4
      Dave Chinner authored
      When doing a direct IO that spans the current EOF, and there are
      written blocks beyond EOF that extend beyond the current write, the
      only metadata update that needs to be done is a file size extension.
      
      However, we don't mark such iomaps as IOMAP_F_DIRTY to indicate that
      there is IO completion metadata updates required, and hence we may
      fail to correctly sync file size extensions made in IO completion
      when O_DSYNC writes are being used and the hardware supports FUA.
      
      Hence when setting IOMAP_F_DIRTY, we need to also take into account
      whether the iomap spans the current EOF. If it does, then we need to
      mark it dirty so that IO completion will call generic_write_sync()
      to flush the inode size update to stable storage correctly.
      
      Fixes: 3460cac1
      
       ("iomap: Use FUA for pure data O_DSYNC DIO writes")
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      [darrick: removed the ext4 part; they'll handle it separately]
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      7684e2c4
  3. Oct 15, 2019
  4. Oct 14, 2019
    • Linus Torvalds's avatar
      Linux 5.4-rc3 · 4f5cafb5
      Linus Torvalds authored
      4f5cafb5
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · d4615e5a
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "A few tracing fixes:
      
         - Remove lockdown from tracefs itself and moved it to the trace
           directory. Have the open functions there do the lockdown checks.
      
         - Fix a few races with opening an instance file and the instance
           being deleted (Discovered during the lockdown updates). Kept
           separate from the clean up code such that they can be backported to
           stable easier.
      
         - Clean up and consolidated the checks done when opening a trace
           file, as there were multiple checks that need to be done, and it
           did not make sense having them done in each open instance.
      
         - Fix a regression in the record mcount code.
      
         - Small hw_lat detector tracer fixes.
      
         - A trace_pipe read fix due to not initializing trace_seq"
      
      * tag 'trace-v5.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Initialize iter->seq after zeroing in tracing_read_pipe()
        tracing/hwlat: Don't ignore outer-loop duration when calculating max_latency
        tracing/hwlat: Report total time spent in all NMIs during the sample
        recordmcount: Fix nop_mcount() function
        tracing: Do not create tracefs files if tracefs lockdown is in effect
        tracing: Add locked_down checks to the open calls of files created for tracefs
        tracing: Add tracing_check_open_get_tr()
        tracing: Have trace events system open call tracing_open_generic_tr()
        tracing: Get trace_array reference for available_tracers files
        ftrace: Get a reference counter for the trace_array on filter files
        tracefs: Revert ccbd54ff ("tracefs: Restrict tracefs when the kernel is locked down")
      d4615e5a
  5. Oct 13, 2019
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v5.4-rc3' of... · 2581efa9
      Linus Torvalds authored
      Merge tag 'hwmon-for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
      
       - Update/fix inspur-ipsps1 and k10temp Documentation
      
       - Fix nct7904 driver
      
       - Fix HWMON_P_MIN_ALARM mask in hwmon core
      
      * tag 'hwmon-for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: docs: Extend inspur-ipsps1 title underline
        hwmon: (nct7904) Add array fan_alarm and vsen_alarm to store the alarms in nct7904_data struct.
        docs: hwmon: Include 'inspur-ipsps1.rst' into docs
        hwmon: Fix HWMON_P_MIN_ALARM mask
        hwmon: (k10temp) Update documentation and add temp2_input info
        hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data struct
      2581efa9
    • Linus Torvalds's avatar
      Merge tag 'fixes-for-5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux · 71b1b553
      Linus Torvalds authored
      Pull MTD fixes from Richard Weinberger:
       "Two fixes for MTD:
      
         - spi-nor: Fix for a regression in write_sr()
      
         - rawnand: Regression fix for the au1550nd driver"
      
      * tag 'fixes-for-5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
        mtd: rawnand: au1550nd: Fix au_read_buf16() prototype
        mtd: spi-nor: Fix direction of the write_sr() transfer
      71b1b553
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20191012' of git://git.kernel.dk/linux-block · b27528b0
      Linus Torvalds authored
      Pull io_uring fix from Jens Axboe:
       "Single small fix for a regression in the sequence logic for linked
        commands"
      
      * tag 'for-linus-20191012' of git://git.kernel.dk/linux-block:
        io_uring: fix sequence logic for timeout requests
      b27528b0
    • Petr Mladek's avatar
      tracing: Initialize iter->seq after zeroing in tracing_read_pipe() · d303de1f
      Petr Mladek authored
      A customer reported the following softlockup:
      
      [899688.160002] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [test.sh:16464]
      [899688.160002] CPU: 0 PID: 16464 Comm: test.sh Not tainted 4.12.14-6.23-azure #1 SLE12-SP4
      [899688.160002] RIP: 0010:up_write+0x1a/0x30
      [899688.160002] Kernel panic - not syncing: softlockup: hung tasks
      [899688.160002] RIP: 0010:up_write+0x1a/0x30
      [899688.160002] RSP: 0018:ffffa86784d4fde8 EFLAGS: 00000257 ORIG_RAX: ffffffffffffff12
      [899688.160002] RAX: ffffffff970fea00 RBX: 0000000000000001 RCX: 0000000000000000
      [899688.160002] RDX: ffffffff00000001 RSI: 0000000000000080 RDI: ffffffff970fea00
      [899688.160002] RBP: ffffffffffffffff R08: ffffffffffffffff R09: 0000000000000000
      [899688.160002] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8b59014720d8
      [899688.160002] R13: ffff8b59014720c0 R14: ffff8b5901471090 R15: ffff8b5901470000
      [899688.160002]  tracing_read_pipe+0x336/0x3c0
      [899688.160002]  __vfs_read+0x26/0x140
      [899688.160002]  vfs_read+0x87/0x130
      [899688.160002]  SyS_read+0x42/0x90
      [899688.160002]  do_syscall_64+0x74/0x160
      
      It caught the process in the middle of trace_access_unlock(). There is
      no loop. So, it must be looping in the caller tracing_read_pipe()
      via the "waitagain" label.
      
      Crashdump analyze uncovered that iter->seq was completely zeroed
      at this point, including iter->seq.seq.size. It means that
      print_trace_line() was never able to print anything and
      there was no forward progress.
      
      The culprit seems to be in the code:
      
      	/* reset all but tr, trace, and overruns */
      	memset(&iter->seq, 0,
      	       sizeof(struct trace_iterator) -
      	       offsetof(struct trace_iterator, seq));
      
      It was added by the commit 53d0aa77
      
       ("ftrace:
      add logic to record overruns"). It was v2.6.27-rc1.
      It was the time when iter->seq looked like:
      
           struct trace_seq {
      	unsigned char		buffer[PAGE_SIZE];
      	unsigned int		len;
           };
      
      There was no "size" variable and zeroing was perfectly fine.
      
      The solution is to reinitialize the structure after or without
      zeroing.
      
      Link: http://lkml.kernel.org/r/20191011142134.11997-1-pmladek@suse.com
      
      Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      d303de1f
    • Srivatsa S. Bhat (VMware)'s avatar
      tracing/hwlat: Don't ignore outer-loop duration when calculating max_latency · fc64e4ad
      Srivatsa S. Bhat (VMware) authored
      max_latency is intended to record the maximum ever observed hardware
      latency, which may occur in either part of the loop (inner/outer). So
      we need to also consider the outer-loop sample when updating
      max_latency.
      
      Link: http://lkml.kernel.org/r/157073345463.17189.18124025522664682811.stgit@srivatsa-ubuntu
      
      Fixes: e7c15cd8
      
       ("tracing: Added hardware latency tracer")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSrivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      fc64e4ad
    • Srivatsa S. Bhat (VMware)'s avatar
      tracing/hwlat: Report total time spent in all NMIs during the sample · 98dc19c1
      Srivatsa S. Bhat (VMware) authored
      nmi_total_ts is supposed to record the total time spent in *all* NMIs
      that occur on the given CPU during the (active portion of the)
      sampling window. However, the code seems to be overwriting this
      variable for each NMI, thereby only recording the time spent in the
      most recent NMI. Fix it by accumulating the duration instead.
      
      Link: http://lkml.kernel.org/r/157073343544.17189.13911783866738671133.stgit@srivatsa-ubuntu
      
      Fixes: 7b2c8625
      
       ("tracing: Add NMI tracing in hwlat detector")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSrivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      98dc19c1
    • Steven Rostedt (VMware)'s avatar
      recordmcount: Fix nop_mcount() function · 7f8557b8
      Steven Rostedt (VMware) authored
      
      
      The removal of the longjmp code in recordmcount.c mistakenly made the return
      of make_nop() being negative an exit of nop_mcount(). It should not exit the
      routine, but instead just not process that part of the code. By exiting with
      an error code, it would cause the update of recordmcount to fail some files
      which would fail the build if ftrace function tracing was enabled.
      
      Link: http://lkml.kernel.org/r/20191009110538.5909fec6@gandalf.local.home
      
      Reported-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Tested-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Fixes: 3f1df120
      
       ("recordmcount: Rewrite error/success handling")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      7f8557b8
    • Steven Rostedt (VMware)'s avatar
      tracing: Do not create tracefs files if tracefs lockdown is in effect · bf8e6021
      Steven Rostedt (VMware) authored
      
      
      If on boot up, lockdown is activated for tracefs, don't even bother creating
      the files. This can also prevent instances from being created if lockdown is
      in effect.
      
      Link: http://lkml.kernel.org/r/CAHk-=whC6Ji=fWnjh2+eS4b15TnbsS4VPVtvBOwCy1jjEG_JHQ@mail.gmail.com
      
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      bf8e6021
    • Steven Rostedt (VMware)'s avatar
      tracing: Add locked_down checks to the open calls of files created for tracefs · 17911ff3
      Steven Rostedt (VMware) authored
      
      
      Added various checks on open tracefs calls to see if tracefs is in lockdown
      mode, and if so, to return -EPERM.
      
      Note, the event format files (which are basically standard on all machines)
      as well as the enabled_functions file (which shows what is currently being
      traced) are not lockde down. Perhaps they should be, but it seems counter
      intuitive to lockdown information to help you know if the system has been
      modified.
      
      Link: http://lkml.kernel.org/r/CAHk-=wj7fGPKUspr579Cii-w_y60PtRaiDgKuxVtBAMK0VNNkA@mail.gmail.com
      
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      17911ff3
    • Steven Rostedt (VMware)'s avatar
      tracing: Add tracing_check_open_get_tr() · 8530dec6
      Steven Rostedt (VMware) authored
      
      
      Currently, most files in the tracefs directory test if tracing_disabled is
      set. If so, it should return -ENODEV. The tracing_disabled is called when
      tracing is found to be broken. Originally it was done in case the ring
      buffer was found to be corrupted, and we wanted to prevent reading it from
      crashing the kernel. But it's also called if a tracing selftest fails on
      boot. It's a one way switch. That is, once it is triggered, tracing is
      disabled until reboot.
      
      As most tracefs files can also be used by instances in the tracefs
      directory, they need to be carefully done. Each instance has a trace_array
      associated to it, and when the instance is removed, the trace_array is
      freed. But if an instance is opened with a reference to the trace_array,
      then it requires looking up the trace_array to get its ref counter (as there
      could be a race with it being deleted and the open itself). Once it is
      found, a reference is added to prevent the instance from being removed (and
      the trace_array associated with it freed).
      
      Combine the two checks (tracing_disabled and trace_array_get()) into a
      single helper function. This will also make it easier to add lockdown to
      tracefs later.
      
      Link: http://lkml.kernel.org/r/20191011135458.7399da44@gandalf.local.home
      
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      8530dec6
    • Steven Rostedt (VMware)'s avatar
      tracing: Have trace events system open call tracing_open_generic_tr() · aa07d71f
      Steven Rostedt (VMware) authored
      
      
      Instead of having the trace events system open call open code the taking of
      the trace_array descriptor (with trace_array_get()) and then calling
      trace_open_generic(), have it use the tracing_open_generic_tr() that does
      the combination of the two. This requires making tracing_open_generic_tr()
      global.
      
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      aa07d71f
    • Steven Rostedt (VMware)'s avatar
      tracing: Get trace_array reference for available_tracers files · 194c2c74
      Steven Rostedt (VMware) authored
      As instances may have different tracers available, we need to look at the
      trace_array descriptor that shows the list of the available tracers for the
      instance. But there's a race between opening the file and an admin
      deleting the instance. The trace_array_get() needs to be called before
      accessing the trace_array.
      
      Cc: stable@vger.kernel.org
      Fixes: 607e2ea1
      
       ("tracing: Set up infrastructure to allow tracers for instances")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      194c2c74
    • Steven Rostedt (VMware)'s avatar
      ftrace: Get a reference counter for the trace_array on filter files · 9ef16693
      Steven Rostedt (VMware) authored
      The ftrace set_ftrace_filter and set_ftrace_notrace files are specific for
      an instance now. They need to take a reference to the instance otherwise
      there could be a race between accessing the files and deleting the instance.
      
      It wasn't until the :mod: caching where these file operations started
      referencing the trace_array directly.
      
      Cc: stable@vger.kernel.org
      Fixes: 673feb9d
      
       ("ftrace: Add :mod: caching infrastructure to trace_array")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      9ef16693