1. 12 Oct, 2020 1 commit
    • Chuck Lever's avatar
      NFSD: Hoist status code encoding into XDR encoder functions · cc028a10
      Chuck Lever authored
      The original intent was presumably to reduce code duplication. The
      trade-off was:
      
      - No support for an NFSD proc function returning a non-success
        RPC accept_stat value.
      - No support for void NFS replies to non-NULL procedures.
      - Everyone pays for the deduplication with a few extra conditional
        branches in a hot path.
      
      In addition, nfsd_dispatch() leaves *statp uninitialized in the
      success path, unlike svc_generic_dispatch().
      
      Address all of these problems by moving the logic for encoding
      the NFS status code into the NFS XDR encoders themselves. Then
      update the NFS .pc_func methods to return an RPC accept_stat
      value.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      cc028a10
  2. 02 Oct, 2020 13 commits
  3. 25 Sep, 2020 19 commits
    • J. Bruce Fields's avatar
      nfsd: rq_lease_breaker cleanup · 13956160
      J. Bruce Fields authored
      Since only the v4 code cares about it, maybe it's better to leave
      rq_lease_breaker out of the common dispatch code?
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      13956160
    • J. Bruce Fields's avatar
      nfsd4: remove check_conflicting_opens warning · 50747dd5
      J. Bruce Fields authored
      There are actually rare races where this is possible (e.g. if a new open
      intervenes between the read of i_writecount and the fi_fds).
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      50747dd5
    • J. Bruce Fields's avatar
      nfsd: Cache R, RW, and W opens separately · ae3c57b5
      J. Bruce Fields authored
      The nfsd open code has always kept separate read-only, read-write, and
      write-only opens as necessary to ensure that when a client closes or
      downgrades, we don't retain more access than necessary.
      
      Also, I didn't realize the cache behaved this way when I wrote
      94415b06 "nfsd4: a client's own opens needn't prevent delegations".
      There I assumed fi_fds[O_WRONLY] and fi_fds[O_RDWR] would always be
      distinct.  The violation of that assumption is triggering a
      WARN_ON_ONCE() and could also cause the server to give out a delegation
      when it shouldn't.
      
      Fixes: 94415b06 ("nfsd4: a client's own opens needn't prevent delegations")
      Tested-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      ae3c57b5
    • J. Bruce Fields's avatar
      sunrpc: simplify do_cache_clean · 0aa99c4d
      J. Bruce Fields authored
      Is it just me, or is the logic written in a slightly convoluted way?
      
      I find it a little easier to read this way.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      0aa99c4d
    • Xu Wang's avatar
      sunrpc: cache : Replace seq_printf with seq_puts · 9dbc1f45
      Xu Wang authored
      seq_puts is a lot cheaper than seq_printf, so use that to print
      literal strings.
      Signed-off-by: default avatarXu Wang <vulab@iscas.ac.cn>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      9dbc1f45
    • Rik van Riel's avatar
      silence nfscache allocation warnings with kvzalloc · 8c38b705
      Rik van Riel authored
      silence nfscache allocation warnings with kvzalloc
      
      Currently nfsd_reply_cache_init attempts hash table allocation through
      kmalloc, and manually falls back to vzalloc if that fails. This makes
      the code a little larger than needed, and creates a significant amount
      of serial console spam if you have enough systems.
      
      Switching to kvzalloc gets rid of the allocation warnings, and makes
      the code a little cleaner too as a side effect.
      
      Freeing of nn->drc_hashtbl is already done using kvfree currently.
      Signed-off-by: default avatarRik van Riel <riel@surriel.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      8c38b705
    • Zheng Bin's avatar
      nfsd: fix comparison to bool warning · 44b49aa6
      Zheng Bin authored
      Fixes coccicheck warning:
      
      fs/nfsd/nfs4proc.c:3234:5-29: WARNING: Comparison to bool
      Signed-off-by: default avatarZheng Bin <zhengbin13@huawei.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      44b49aa6
    • Chuck Lever's avatar
      NFSD: Correct type annotations in COPY XDR functions · 5aff7d08
      Chuck Lever authored
      Squelch some sparse warnings:
      
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:1860:16: warning: incorrect type in assignment (different base types)
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:1860:16:    expected int status
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:1860:16:    got restricted __be32
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:1862:24: warning: incorrect type in return expression (different base types)
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:1862:24:    expected restricted __be32
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:1862:24:    got int status
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      5aff7d08
    • Chuck Lever's avatar
      NFSD: Correct type annotations in user xattr XDR functions · b9a49237
      Chuck Lever authored
      Squelch some sparse warnings:
      
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4692:24: warning: incorrect type in return expression (different base types)
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4692:24:    expected int
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4692:24:    got restricted __be32 [usertype]
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4702:32: warning: incorrect type in return expression (different base types)
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4702:32:    expected int
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4702:32:    got restricted __be32 [usertype]
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4739:13: warning: incorrect type in assignment (different base types)
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4739:13:    expected restricted __be32 [usertype] err
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4739:13:    got int
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4891:15: warning: incorrect type in assignment (different base types)
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4891:15:    expected unsigned int [assigned] [usertype] count
      /home/cel/src/linux/linux/fs/nfsd/nfs4xdr.c:4891:15:    got restricted __be32 [usertype]
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      b9a49237
    • Chuck Lever's avatar
      NFSD: Correct type annotations in user xattr helpers · 8237284a
      Chuck Lever authored
      Squelch some sparse warnings:
      
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2264:13: warning: incorrect type in assignment (different base types)
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2264:13:    expected int err
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2264:13:    got restricted __be32
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2266:24: warning: incorrect type in return expression (different base types)
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2266:24:    expected restricted __be32
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2266:24:    got int err
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2288:13: warning: incorrect type in assignment (different base types)
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2288:13:    expected int err
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2288:13:    got restricted __be32
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2290:24: warning: incorrect type in return expression (different base types)
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2290:24:    expected restricted __be32
      /home/cel/src/linux/linux/fs/nfsd/vfs.c:2290:24:    got int err
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      8237284a
    • Anna Schumaker's avatar
      SUNRPC/NFSD: Implement xdr_reserve_space_vec() · 403217f3
      Anna Schumaker authored
      Reserving space for a large READ payload requires special handling when
      reserving space in the xdr buffer pages. One problem we can have is use
      of the scratch buffer, which is used to get a pointer to a contiguous
      region of data up to PAGE_SIZE. When using the scratch buffer, calls to
      xdr_commit_encode() shift the data to it's proper alignment in the xdr
      buffer. If we've reserved several pages in a vector, then this could
      potentially invalidate earlier pointers and result in incorrect READ
      data being sent to the client.
      
      I get around this by looking at the amount of space left in the current
      page, and never reserve more than that for each entry in the read
      vector. This lets us place data directly where it needs to go in the
      buffer pages.
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      403217f3
    • Hou Tao's avatar
      nfsd: rename delegation related tracepoints to make them less confusing · 3caf9175
      Hou Tao authored
      Now when a read delegation is given, two delegation related traces
      will be printed:
      
          nfsd_deleg_open: client 5f45b854:e6058001 stateid 00000030:00000001
          nfsd_deleg_none: client 5f45b854:e6058001 stateid 0000002f:00000001
      
      Although the intention is to let developers know two stateid are
      returned, the traces are confusing about whether or not a read delegation
      is handled out. So renaming trace_nfsd_deleg_none() to trace_nfsd_open()
      and trace_nfsd_deleg_open() to trace_nfsd_deleg_read() to make
      the intension clearer.
      
      The patched traces will be:
      
          nfsd_deleg_read: client 5f48a967:b55b21cd stateid 00000003:00000001
          nfsd_open: client 5f48a967:b55b21cd stateid 00000002:00000001
      Suggested-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      3caf9175
    • J. Bruce Fields's avatar
      Documentation: update RPCSEC_GSSv3 RFC link · ade3dbad
      J. Bruce Fields authored
      This draft is an official RFC now.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      ade3dbad
    • J. Bruce Fields's avatar
      MAINTAINERS: Note NFS docs under Documentation/ · ff7e11f3
      J. Bruce Fields authored
      It struck me while watching Jon Corbet ask how to keep kernel
      Documentation up to date, that it might help if we were actually cc'd on
      Documentation/filesystems/nfs/ changes.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      ff7e11f3
    • Alex Dewar's avatar
      nfsd: Remove unnecessary assignment in nfs4xdr.c · e2a1840e
      Alex Dewar authored
      In nfsd4_encode_listxattrs(), the variable p is assigned to at one point
      but this value is never used before p is reassigned. Fix this.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: default avatarAlex Dewar <alex.dewar90@gmail.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      e2a1840e
    • Randy Dunlap's avatar
      net: sunrpc: delete repeated words · 1cc5213b
      Randy Dunlap authored
      Drop duplicate words in net/sunrpc/.
      Also fix "Anyone" to be "Any one".
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Cc: linux-nfs@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      1cc5213b
    • Alex Dewar's avatar
      nfsd: Fix typo in comment · 4cce11fa
      Alex Dewar authored
      Missing "is".
      Signed-off-by: default avatarAlex Dewar <alex.dewar90@gmail.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      4cce11fa
    • J. Bruce Fields's avatar
      nfsd: give up callbacks on revoked delegations · 12ed22f3
      J. Bruce Fields authored
      The delegation is no longer returnable, so I don't think there's much
      point retrying the recall.
      
      (I think it's worth asking why we even need separate CLOSED_DELEG and
      REVOKED_DELEG states.  But treating them the same would currently cause
      nfsd4_free_stateid to call list_del_init(&dp->dl_recall_lru) on a
      delegation that the laundromat had unhashed but not revoked, incorrectly
      removing it from the laundromat's reaplist or a client's dl_recall_lru.)
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      12ed22f3
    • J. Bruce Fields's avatar
      nfsd: remove fault injection code · e56dc9e2
      J. Bruce Fields authored
      It was an interesting idea but nobody seems to be using it, it's buggy
      at this point, and nfs4state.c is already complicated enough without it.
      The new nfsd/clients/ code provides some of the same functionality, and
      could probably do more if desired.
      
      This feature has been deprecated since 9d60d931 ("Deprecate nfsd
      fault injection").
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      e56dc9e2
  4. 13 Sep, 2020 7 commits
    • Linus Torvalds's avatar
      Linux 5.9-rc5 · 856deb86
      Linus Torvalds authored
      856deb86
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 5712c3ed
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A collection of fixes I've been accruing over the last few weeks, none
        of them have been severe enough to warrant flushing the queue but it's
        been long enough now that it's a good idea to send them in.
      
        A handful of them are fixups for QSPI DT/bindings/compatibles, some
        smaller fixes for system DMA clock control and TMU interrupts on i.MX,
        a handful of fixes for OMAP, including a fix for DSI (display) on
        omap5"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (27 commits)
        arm64: dts: ns2: Fixed QSPI compatible string
        ARM: dts: BCM5301X: Fixed QSPI compatible string
        ARM: dts: NSP: Fixed QSPI compatible string
        ARM: dts: bcm: HR2: Fixed QSPI compatible string
        dt-bindings: spi: Fix spi-bcm-qspi compatible ordering
        ARM: dts: imx6sx: fix the pad QSPI1B_SCLK mux mode for uart3
        arm64: dts: imx8mp: correct sdma1 clk setting
        arm64: dts: imx8mq: Fix TMU interrupt property
        ARM: dts: imx7d-zii-rmu2: fix rgmii phy-mode for ksz9031 phy
        ARM: dts: vfxxx: Add syscon compatible with OCOTP
        ARM: dts: imx6q-logicpd: Fix broken PWM
        arm64: dts: imx: Add missing imx8mm-beacon-kit.dtb to build
        ARM: dts: imx6q-prtwd2: Remove unneeded i2c unit name
        ARM: dts: imx6qdl-gw51xx: Remove unneeded #address-cells/#size-cells
        ARM: dts: imx7ulp: Correct gpio ranges
        ARM: dts: ls1021a: fix QuadSPI-memory reg range
        arm64: defconfig: Enable ptn5150 extcon driver
        arm64: defconfig: Enable USB gadget with configfs
        ARM: configs: Update Integrator defconfig
        ARM: dts: omap5: Fix DSI base address and clocks
        ...
      5712c3ed
    • Linus Torvalds's avatar
      Merge tag 'usb-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · e4c26faa
      Linus Torvalds authored
      Pull USB/Thunderbolt fixes from Greg KH:
       "Here are some small USB and Thunderbolt driver fixes for 5.9-rc5.
      
        Nothing huge, just a number of bugfixes and new device ids for
        problems reported:
      
         - new USB serial driver ids
      
         - bug fixes for syzbot reported problems
      
         - typec driver fixes
      
         - thunderbolt driver fixes
      
         - revert of reported broken commit
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'usb-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: typec: intel_pmc_mux: Do not configure SBU and HSL Orientation in Alternate modes
        usb: typec: intel_pmc_mux: Do not configure Altmode HPD High
        usb: core: fix slab-out-of-bounds Read in read_descriptors
        Revert "usb: dwc3: meson-g12a: fix shared reset control use"
        usb: typec: ucsi: acpi: Check the _DEP dependencies
        usb: typec: intel_pmc_mux: Un-register the USB role switch
        usb: Fix out of sync data toggle if a configured device is reconfigured
        USB: serial: option: support dynamic Quectel USB compositions
        USB: serial: option: add support for SIM7070/SIM7080/SIM7090 modules
        thunderbolt: Use maximum USB3 link rate when reclaiming if link is not up
        thunderbolt: Disable ports that are not implemented
        USB: serial: ftdi_sio: add IDs for Xsens Mti USB converter
      e4c26faa
    • Linus Torvalds's avatar
      Merge tag 'staging-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 6c7247f6
      Linus Torvalds authored
      Pull staging/IIO driver fixes from Greg KH:
       "Here are a number of staging and IIO driver fixes for 5.9-rc5.
      
        The majority of these are IIO driver fixes, to resolve a timestamp
        issue that was recently found to affect a bunch of IIO drivers.
      
        The other fixes in here are:
      
         - small IIO driver fixes
      
         - greybus driver fix
      
         - counter driver fix (came in through the IIO fixes tree)
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'staging-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (23 commits)
        iio: adc: mcp3422: fix locking on error path
        iio: adc: mcp3422: fix locking scope
        iio: adc: meson-saradc: Use the parent device to look up the calib data
        iio:adc:max1118 Fix alignment of timestamp and data leak issues
        iio:adc:ina2xx Fix timestamp alignment issue.
        iio:adc:ti-adc084s021 Fix alignment and data leak issues.
        iio:adc:ti-adc081c Fix alignment and data leak issues
        iio:magnetometer:ak8975 Fix alignment and data leak issues.
        iio:light:ltr501 Fix timestamp alignment issue.
        iio:light:max44000 Fix timestamp alignment and prevent data leak.
        iio:chemical:ccs811: Fix timestamp alignment and prevent data leak.
        iio:proximity:mb1232: Fix timestamp alignment and prevent data leak.
        iio:accel:mma7455: Fix timestamp alignment and prevent data leak.
        iio:accel:bmc150-accel: Fix timestamp alignment and prevent data leak.
        iio:accel:mma8452: Fix timestamp alignment and prevent data leak.
        iio: accel: kxsd9: Fix alignment of local buffer.
        iio: adc: rockchip_saradc: select IIO_TRIGGERED_BUFFER
        iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
        counter: microchip-tcb-capture: check the correct variable
        iio: cros_ec: Set Gyroscope default frequency to 25Hz
        ...
      6c7247f6
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · 20a7b6be
      Linus Torvalds authored
      Pull driver core fixes from Greg KH:
       "Here are some small driver core and debugfs fixes for 5.9-rc5
      
        Included in here are:
      
         - firmware loader memory leak fix
      
         - firmware loader testing fixes for non-EFI systems
      
         - device link locking fixes found by lockdep
      
         - kobject_del() bugfix that has been affecting some callers
      
         - debugfs minor fix
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'driver-core-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        test_firmware: Test platform fw loading on non-EFI systems
        PM: <linux/device.h>: fix @em_pd kernel-doc warning
        kobject: Drop unneeded conditional in __kobject_del()
        driver core: Fix device_pm_lock() locking for device links
        MAINTAINERS: Add the security document to SECURITY CONTACT
        driver code: print symbolic error code
        debugfs: Fix module state check condition
        kobject: Restore old behaviour of kobject_del(NULL)
        firmware_loader: fix memory leak for paged buffer
      20a7b6be
    • Olof Johansson's avatar
      Merge tag 'arm-soc/for-5.9/devicetree-fixes' of https://github.com/Broadcom/stblinux into arm/fixes · a4da411e
      Olof Johansson authored
      This pull request contains Broadcom ARM-based SoCs Device Tree fixes for
      5.9, please pull the following:
      
      - Florian fixes the Broadcom QSPI controller binding such that the most
        specific compatible string is the left most one, and all existing
        in-tree users are updated as well.
      
      * tag 'arm-soc/for-5.9/devicetree-fixes' of https://github.com/Broadcom/stblinux:
        arm64: dts: ns2: Fixed QSPI compatible string
        ARM: dts: BCM5301X: Fixed QSPI compatible string
        ARM: dts: NSP: Fixed QSPI compatible string
        ARM: dts: bcm: HR2: Fixed QSPI compatible string
        dt-bindings: spi: Fix spi-bcm-qspi compatible ordering
      
      Link: https://lore.kernel.org/r/20200909211857.4144718-1-f.fainelli@gmail.comSigned-off-by: default avatarOlof Johansson <olof@lixom.net>
      a4da411e
    • Olof Johansson's avatar
      Merge tag 'imx-fixes-5.9-2' of... · 2aedcb04
      Olof Johansson authored
      Merge tag 'imx-fixes-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into arm/fixes
      
      i.MX fixes for 5.9, round 2:
      
      - Fix the misspelling of 'interrupts' property in i.MX8MQ TMU DT node.
      - Correct 'ahb' clock for i.MX8MP SDMA1 in device tree.
      - Fix pad QSPI1B_SCLK mux mode for UART3 on i.MX6SX.
      
      * tag 'imx-fixes-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
        ARM: dts: imx6sx: fix the pad QSPI1B_SCLK mux mode for uart3
        arm64: dts: imx8mp: correct sdma1 clk setting
        arm64: dts: imx8mq: Fix TMU interrupt property
      
      Link: https://lore.kernel.org/r/20200909143844.GA25109@dragonSigned-off-by: default avatarOlof Johansson <olof@lixom.net>
      2aedcb04