Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1617711 > unrolled thread

[PATCH 4.10 00/81] 4.10.9-stable review

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-04-06 11:10 +0200
Last post2017-04-07 10:20 +0200
Articles 14 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 4.10 00/81] 4.10.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:10 +0200
    [PATCH 4.10 06/81] xfs: fix toctou race when locking an inode to access the data map Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:10 +0200
    [PATCH 4.10 02/81] KVM: nVMX: fix nested EPT detection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:10 +0200
    [PATCH 4.10 42/81] mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:10 +0200
    [PATCH 4.10 11/81] xfs: allow unwritten extents in the CoW fork Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
    [PATCH 4.10 18/81] xfs: handle indlen shortage on delalloc extent merge Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
    [PATCH 4.10 16/81] xfs: correct null checks and error processing in xfs_initialize_perag Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
    [PATCH 4.10 10/81] xfs: verify free block header fields Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
    [PATCH 4.10 13/81] xfs: reset b_first_retry_time when clear the retry status of xfs_buf_t Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
    [PATCH 4.10 15/81] xfs: update ctime and mtime on clone destinatation inodes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
    Re: [PATCH 4.10 00/81] 4.10.9-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-04-06 20:00 +0200
      Re: [PATCH 4.10 00/81] 4.10.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 20:10 +0200
    Re: [PATCH 4.10 00/81] 4.10.9-stable review Guenter Roeck <linux@roeck-us.net> - 2017-04-07 00:00 +0200
      Re: [PATCH 4.10 00/81] 4.10.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-07 10:20 +0200

#1617711 — [PATCH 4.10 00/81] 4.10.9-stable review

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:10 +0200
Subject[PATCH 4.10 00/81] 4.10.9-stable review
Message-ID<ttbh8-6aP-9@gated-at.bofh.it>
This is the start of the stable review cycle for the 4.10.9 release.
There are 81 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sat Apr  8 08:36:05 UTC 2017.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.9-rc1.gz
or in the git tree and branch at:
  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.10.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.10.9-rc1

Zhi Wang <zhi.a.wang@intel.com>
    drm/i915: A hotfix for making aliasing PPGTT work for GVT-g

Zhi Wang <zhi.a.wang@intel.com>
    drm/i915: Let execlist_update_context() cover !FULL_PPGTT mode.

Zhi Wang <zhi.a.wang@intel.com>
    drm/i915: Move the release of PT page to the upper caller

Keith Busch <keith.busch@intel.com>
    nvme/pci: Disable on removal when disconnected

Keith Busch <keith.busch@intel.com>
    nvme/core: Fix race kicking freed request_queue

Jason A. Donenfeld <Jason@zx2c4.com>
    padata: avoid race in reordering

NeilBrown <neilb@suse.com>
    blk: Ensure users for current->bio_list can see the full list.

NeilBrown <neilb@suse.com>
    blk: improve order of bio handling in generic_make_request()

Felix Fietkau <nbd@nbd.name>
    MIPS: Lantiq: Fix cascaded IRQ setup

Jon Mason <jon.mason@broadcom.com>
    ARM: dts: BCM5301X: Correct GIC_PPI interrupt flags

Daniel Vetter <daniel.vetter@ffwll.ch>
    drm/armada: Fix compile fail

Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd()

Johannes Weiner <hannes@cmpxchg.org>
    mm: workingset: fix premature shadow node shrinking with cgroups

Johannes Weiner <hannes@cmpxchg.org>
    mm: rmap: fix huge file mmap accounting in the memcg stats

Kees Cook <keescook@chromium.org>
    lib/syscall: Clear return values when no stack

Tony Luck <tony.luck@intel.com>
    x86/mce: Fix copy/paste error in exception table entries

Baoquan He <bhe@redhat.com>
    x86/mm/KASLR: Exclude EFI region from KASLR VA space randomization

Alex Williamson <alex.williamson@redhat.com>
    drm/i915/kvmgt: Hold struct kvm reference

Lucas Stach <l.stach@pengutronix.de>
    drm/etnaviv: (re-)protect fence allocation with GPU mutex

Eric Anholt <eric@anholt.net>
    drm/vc4: Allocate the right amount of space for boot-time CRTC state.

Michel Dänzer <michel.daenzer@amd.com>
    drm/radeon: Override fpfn for all VRAM placements in radeon_evict_flags

David Hildenbrand <david@redhat.com>
    KVM: kvm_io_bus_unregister_dev() should never fail

Peter Xu <peterx@redhat.com>
    KVM: x86: clear bus pointer when destroyed

Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    serial: mxs-auart: Fix baudrate calculation

Alan Stern <stern@rowland.harvard.edu>
    USB: fix linked-list corruption in rh_call_control()

Mathias Nyman <mathias.nyman@linux.intel.com>
    xhci: Set URB actual length for stopped control transfers

Nicolas Ferre <nicolas.ferre@microchip.com>
    tty/serial: atmel: fix TX path in atmel_console_write()

Richard Genoud <richard.genoud@gmail.com>
    tty/serial: atmel: fix race condition (TX+DMA)

Joerg Roedel <jroedel@suse.de>
    ACPI: Do not create a platform_device for IOAPIC/IOxAPIC

Josh Poimboeuf <jpoimboe@redhat.com>
    ACPI: Fix incompatibility with mcount-based function graph tracing

Helge Deller <deller@gmx.de>
    parisc: Fix access fault handling in pa_memcpy()

Helge Deller <deller@gmx.de>
    parisc: Avoid stalled CPU warnings after system shutdown

Helge Deller <deller@gmx.de>
    parisc: Clean up fixup routines for get_user()/put_user()

Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
    dt-bindings: rng: clocks property on omap_rng not always mandatory

Kinglong Mee <kinglongmee@gmail.com>
    nfsd: map the ENOKEY to nfserr_perm for avoiding warning

Olga Kornievskaia <kolga@netapp.com>
    NFSv4.1 fix infinite loop on IO BAD_STATEID error

Alexey Brodkin <abrodkin@synopsys.com>
    ARCv2: SLC: Make sure busy bit is set properly on SLC flushing

Eric Biggers <ebiggers@google.com>
    crypto: xts,lrw - fix out-of-bounds write after kmalloc failure

Gary R Hook <gary.hook@amd.com>
    crypto: ccp - Make some CCP DMA channels private

Ludovic Desroches <ludovic.desroches@microchip.com>
    mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection

Hans de Goede <hdegoede@redhat.com>
    mmc: sdhci: Disable runtime pm when the sdio_irq is enabled

Aaron Armstrong Skomra <skomra@gmail.com>
    HID: wacom: Don't add ghost interface as shared data

Bard Liao <bardliao@realtek.com>
    ASoC: rt5665: fix getting wrong work handler container

Takashi Sakamoto <takashi.sakamoto@miraclelinux.com>
    ASoC: Intel: Skylake: fix invalid memory access due to wrong reference of pointer

Songjun Wu <songjun.wu@microchip.com>
    ASoC: atmel-classd: fix audio clock rate

Hui Wang <hui.wang@canonical.com>
    ALSA: hda - fix a problem for lineout on a Dell AIO machine

Takashi Iwai <tiwai@suse.de>
    ALSA: seq: Fix race during FIFO resize

Tomasz Nowicki <tn@semihalf.com>
    PCI: thunder-pem: Use Cavium assigned hardware ID for ThunderX host controller

Bjorn Helgaas <bhelgaas@google.com>
    PCI: iproc: Save host bridge window resource in struct iproc_pcie

Bart Van Assche <bart.vanassche@sandisk.com>
    scsi: scsi_dh_alua: Ensure that alua_activate() calls the completion function

Bart Van Assche <bart.vanassche@sandisk.com>
    scsi: scsi_dh_alua: Check scsi_device_get() return value

John Garry <john.garry@huawei.com>
    scsi: libsas: fix ata xfer length

peter chang <dpf@google.com>
    scsi: sg: check length passed to SG_NEXT_CMD_LEN

Christoph Hellwig <hch@lst.de>
    xfs: try any AG when allocating the first btree block when reflinking

Brian Foster <bfoster@redhat.com>
    xfs: use iomap new flag for newly allocated delalloc blocks

Chandan Rajendra <chandan@linux.vnet.ibm.com>
    xfs: Use xfs_icluster_size_fsb() to calculate inode alignment mask

Christoph Hellwig <hch@lst.de>
    xfs: fix and streamline error handling in xfs_end_io

Christoph Hellwig <hch@lst.de>
    xfs: only reclaim unwritten COW extents periodically

Christoph Hellwig <hch@lst.de>
    xfs: tune down agno asserts in the bmap code

Chandan Rajendra <chandan@linux.vnet.ibm.com>
    xfs: Use xfs_icluster_size_fsb() to calculate inode chunk alignment

Brian Foster <bfoster@redhat.com>
    xfs: don't reserve blocks for right shift transactions

Darrick J. Wong <darrick.wong@oracle.com>
    xfs: fix uninitialized variable in _reflink_convert_cow

Brian Foster <bfoster@redhat.com>
    xfs: split indlen reservations fairly when under reserved

Brian Foster <bfoster@redhat.com>
    xfs: handle indlen shortage on delalloc extent merge

Christoph Hellwig <hch@lst.de>
    xfs: don't fail xfs_extent_busy allocation

Bill O'Donnell <billodo@redhat.com>
    xfs: correct null checks and error processing in xfs_initialize_perag

Christoph Hellwig <hch@lst.de>
    xfs: update ctime and mtime on clone destinatation inodes

Christoph Hellwig <hch@lst.de>
    xfs: reject all unaligned direct writes to reflinked files

Hou Tao <houtao1@huawei.com>
    xfs: reset b_first_retry_time when clear the retry status of xfs_buf_t

Darrick J. Wong <darrick.wong@oracle.com>
    xfs: mark speculative prealloc CoW fork extents unwritten

Darrick J. Wong <darrick.wong@oracle.com>
    xfs: allow unwritten extents in the CoW fork

Darrick J. Wong <darrick.wong@oracle.com>
    xfs: verify free block header fields

Darrick J. Wong <darrick.wong@oracle.com>
    xfs: check for obviously bad level values in the bmbt root

Darrick J. Wong <darrick.wong@oracle.com>
    xfs: filter out obviously bad btree pointers

Darrick J. Wong <darrick.wong@oracle.com>
    xfs: fail _dir_open when readahead fails

Darrick J. Wong <darrick.wong@oracle.com>
    xfs: fix toctou race when locking an inode to access the data map

Brian Foster <bfoster@redhat.com>
    xfs: fix eofblocks race with file extending async dio writes

Brian Foster <bfoster@redhat.com>
    xfs: sync eofblocks scans under iolock are livelock prone

Brian Foster <bfoster@redhat.com>
    xfs: pull up iolock from xfs_free_eofblocks()

Ladi Prosek <lprosek@redhat.com>
    KVM: nVMX: fix nested EPT detection

Ilya Dryomov <idryomov@gmail.com>
    libceph: force GFP_NOIO for socket allocations


-------------

Diffstat:

 Documentation/devicetree/bindings/rng/omap_rng.txt |   3 +-
 Makefile                                           |   4 +-
 arch/arc/mm/cache.c                                |   3 +
 arch/arm/boot/dts/bcm5301x.dtsi                    |   4 +-
 arch/mips/lantiq/irq.c                             |  38 +-
 arch/parisc/include/asm/uaccess.h                  |  59 +--
 arch/parisc/kernel/parisc_ksyms.c                  |  10 -
 arch/parisc/kernel/process.c                       |   2 +
 arch/parisc/lib/Makefile                           |   2 +-
 arch/parisc/lib/fixup.S                            |  98 -----
 arch/parisc/lib/lusercopy.S                        | 318 ++++++++++++++
 arch/parisc/lib/memcpy.c                           | 461 +--------------------
 arch/parisc/mm/fault.c                             |  17 +
 arch/x86/kvm/vmx.c                                 |   4 +-
 arch/x86/lib/memcpy_64.S                           |   2 +-
 arch/x86/mm/kaslr.c                                |   4 +-
 block/bio.c                                        |  12 +-
 block/blk-core.c                                   |  39 +-
 crypto/lrw.c                                       |   7 +-
 crypto/xts.c                                       |   7 +-
 drivers/acpi/Makefile                              |   1 -
 drivers/acpi/acpi_platform.c                       |   8 +-
 drivers/crypto/ccp/ccp-dev-v5.c                    |   1 +
 drivers/crypto/ccp/ccp-dev.h                       |   5 +
 drivers/crypto/ccp/ccp-dmaengine.c                 |  41 ++
 drivers/gpu/drm/armada/Makefile                    |   2 +
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c              |   4 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                   |   2 +
 drivers/gpu/drm/i915/i915_gem_gtt.c                |  21 +-
 drivers/gpu/drm/i915/intel_lrc.c                   |   3 +-
 drivers/gpu/drm/radeon/radeon_ttm.c                |   4 +-
 drivers/gpu/drm/vc4/vc4_crtc.c                     |  13 +-
 drivers/hid/wacom_sys.c                            |  16 +-
 drivers/md/dm.c                                    |  29 +-
 drivers/md/raid10.c                                |   3 +-
 drivers/mmc/host/sdhci-of-at91.c                   |  11 +-
 drivers/mmc/host/sdhci.c                           |   6 +
 drivers/nvme/host/core.c                           |   6 +-
 drivers/nvme/host/pci.c                            |   4 +-
 drivers/pci/host/pci-thunder-pem.c                 |   2 +-
 drivers/pci/host/pcie-iproc-bcma.c                 |  24 +-
 drivers/pci/host/pcie-iproc-platform.c             |  19 +-
 drivers/pci/host/pcie-iproc.h                      |   1 +
 drivers/scsi/device_handler/scsi_dh_alua.c         |  38 +-
 drivers/scsi/libsas/sas_ata.c                      |   2 +-
 drivers/scsi/sg.c                                  |   2 +
 drivers/tty/serial/atmel_serial.c                  |   8 +
 drivers/tty/serial/mxs-auart.c                     |   2 +-
 drivers/usb/core/hcd.c                             |   7 +-
 drivers/usb/host/xhci-ring.c                       |   3 +
 fs/nfs/nfs4proc.c                                  |   9 +-
 fs/nfsd/nfsproc.c                                  |   1 +
 fs/xfs/libxfs/xfs_bmap.c                           | 211 ++++++----
 fs/xfs/libxfs/xfs_bmap_btree.c                     |   6 +-
 fs/xfs/libxfs/xfs_btree.c                          |   3 +-
 fs/xfs/libxfs/xfs_btree.h                          |   2 +-
 fs/xfs/libxfs/xfs_da_btree.c                       |   6 +-
 fs/xfs/libxfs/xfs_da_btree.h                       |   2 +-
 fs/xfs/libxfs/xfs_dir2_node.c                      |  51 ++-
 fs/xfs/libxfs/xfs_ialloc.c                         |   3 +-
 fs/xfs/libxfs/xfs_inode_fork.c                     |   9 +-
 fs/xfs/xfs_aops.c                                  |  65 +--
 fs/xfs/xfs_bmap_util.c                             |  62 ++-
 fs/xfs/xfs_bmap_util.h                             |   3 +-
 fs/xfs/xfs_buf_item.c                              |   1 +
 fs/xfs/xfs_extent_busy.c                           |  13 +-
 fs/xfs/xfs_file.c                                  |  26 +-
 fs/xfs/xfs_icache.c                                |  61 +--
 fs/xfs/xfs_icache.h                                |   2 -
 fs/xfs/xfs_inode.c                                 |  53 +--
 fs/xfs/xfs_iomap.c                                 |  30 +-
 fs/xfs/xfs_mount.c                                 |  27 +-
 fs/xfs/xfs_reflink.c                               | 151 ++++++-
 fs/xfs/xfs_reflink.h                               |   6 +-
 fs/xfs/xfs_super.c                                 |   2 +-
 fs/xfs/xfs_trace.h                                 |  10 +-
 include/linux/kvm_host.h                           |   4 +-
 include/linux/memcontrol.h                         |   6 +
 kernel/padata.c                                    |   5 +-
 lib/syscall.c                                      |   1 +
 mm/hugetlb.c                                       |   6 +-
 mm/rmap.c                                          |   4 +-
 mm/workingset.c                                    |   2 +-
 net/ceph/messenger.c                               |   6 +
 sound/core/seq/seq_fifo.c                          |   4 +
 sound/pci/hda/patch_realtek.c                      |  12 +-
 sound/soc/atmel/atmel-classd.c                     |   2 +-
 sound/soc/codecs/rt5665.c                          |   2 +-
 sound/soc/intel/skylake/skl-topology.c             |   2 +-
 virt/kvm/eventfd.c                                 |   3 +-
 virt/kvm/kvm_main.c                                |  42 +-
 91 files changed, 1230 insertions(+), 1068 deletions(-)

[toc] | [next] | [standalone]


#1617712 — [PATCH 4.10 06/81] xfs: fix toctou race when locking an inode to access the data map

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:10 +0200
Subject[PATCH 4.10 06/81] xfs: fix toctou race when locking an inode to access the data map
Message-ID<ttbAw-6xa-65@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Darrick J. Wong <darrick.wong@oracle.com>

commit 4b5bd5bf3fb182dc504b1b64e0331300f156e756 upstream.

We use di_format and if_flags to decide whether we're grabbing the ilock
in btree mode (btree extents not loaded) or shared mode (anything else),
but the state of those fields can be changed by other threads that are
also trying to load the btree extents -- IFEXTENTS gets set before the
_bmap_read_extents call and cleared if it fails.

We don't actually need to have IFEXTENTS set until after the bmbt
records are successfully loaded and validated, which will fix the race
between multiple threads trying to read the same directory.  The next
patch strengthens directory bmbt validation by refusing to open the
directory if reading the bmbt to start directory readahead fails.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/libxfs/xfs_inode_fork.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -497,15 +497,14 @@ xfs_iread_extents(
 	 * We know that the size is valid (it's checked in iformat_btree)
 	 */
 	ifp->if_bytes = ifp->if_real_bytes = 0;
-	ifp->if_flags |= XFS_IFEXTENTS;
 	xfs_iext_add(ifp, 0, nextents);
 	error = xfs_bmap_read_extents(tp, ip, whichfork);
 	if (error) {
 		xfs_iext_destroy(ifp);
-		ifp->if_flags &= ~XFS_IFEXTENTS;
 		return error;
 	}
 	xfs_validate_extents(ifp, nextents, XFS_EXTFMT_INODE(ip));
+	ifp->if_flags |= XFS_IFEXTENTS;
 	return 0;
 }
 /*

[toc] | [prev] | [next] | [standalone]


#1617713 — [PATCH 4.10 02/81] KVM: nVMX: fix nested EPT detection

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:10 +0200
Subject[PATCH 4.10 02/81] KVM: nVMX: fix nested EPT detection
Message-ID<ttbAw-6xa-71@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ladi Prosek <lprosek@redhat.com>

commit 7ad658b693536741c37b16aeb07840a2ce75f5b9 upstream.

The nested_ept_enabled flag introduced in commit 7ca29de2136 was not
computed correctly. We are interested only in L1's EPT state, not the
the combined L0+L1 value.

In particular, if L0 uses EPT but L1 does not, nested_ept_enabled must
be false to make sure that PDPSTRs are loaded based on CR3 as usual,
because the special case described in 26.3.2.4 Loading Page-Directory-
Pointer-Table Entries does not apply.

Fixes: 7ca29de21362 ("KVM: nVMX: fix CR3 load if L2 uses PAE paging and EPT")
Cc: qemu-stable@nongnu.org
Reported-by: Wanpeng Li <wanpeng.li@hotmail.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kvm/vmx.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -10027,7 +10027,6 @@ static int prepare_vmcs02(struct kvm_vcp
 {
 	struct vcpu_vmx *vmx = to_vmx(vcpu);
 	u32 exec_control;
-	bool nested_ept_enabled = false;
 
 	vmcs_write16(GUEST_ES_SELECTOR, vmcs12->guest_es_selector);
 	vmcs_write16(GUEST_CS_SELECTOR, vmcs12->guest_cs_selector);
@@ -10192,7 +10191,6 @@ static int prepare_vmcs02(struct kvm_vcp
 				vmcs12->guest_intr_status);
 		}
 
-		nested_ept_enabled = (exec_control & SECONDARY_EXEC_ENABLE_EPT) != 0;
 		vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
 	}
 
@@ -10344,7 +10342,7 @@ static int prepare_vmcs02(struct kvm_vcp
 	vmx_set_efer(vcpu, vcpu->arch.efer);
 
 	/* Shadow page tables on either EPT or shadow page tables. */
-	if (nested_vmx_load_cr3(vcpu, vmcs12->guest_cr3, nested_ept_enabled,
+	if (nested_vmx_load_cr3(vcpu, vmcs12->guest_cr3, nested_cpu_has_ept(vmcs12),
 				entry_failure_code))
 		return 1;
 

[toc] | [prev] | [next] | [standalone]


#1617716 — [PATCH 4.10 42/81] mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:10 +0200
Subject[PATCH 4.10 42/81] mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection
Message-ID<ttbAw-6xa-77@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ludovic Desroches <ludovic.desroches@microchip.com>

commit d0918764c17b94c30bbb2619929b1719ff52707a upstream.

The controller has different timings for MMC_TIMING_UHS_DDR50 and
MMC_TIMING_MMC_DDR52. Configuring the controller with SDHCI_CTRL_UHS_DDR50,
when MMC_TIMING_MMC_DDR52 timings are requested, is not correct and can
lead to unexpected behavior.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Fixes: bb5f8ea4d514 ("mmc: sdhci-of-at91: introduce driver for the Atmel SDMMC")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sdhci-of-at91.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -29,6 +29,8 @@
 
 #include "sdhci-pltfm.h"
 
+#define SDMMC_MC1R	0x204
+#define		SDMMC_MC1R_DDR		BIT(3)
 #define SDMMC_CACR	0x230
 #define		SDMMC_CACR_CAPWREN	BIT(0)
 #define		SDMMC_CACR_KEY		(0x46 << 8)
@@ -103,11 +105,18 @@ static void sdhci_at91_set_power(struct
 	sdhci_set_power_noreg(host, mode, vdd);
 }
 
+void sdhci_at91_set_uhs_signaling(struct sdhci_host *host, unsigned int timing)
+{
+	if (timing == MMC_TIMING_MMC_DDR52)
+		sdhci_writeb(host, SDMMC_MC1R_DDR, SDMMC_MC1R);
+	sdhci_set_uhs_signaling(host, timing);
+}
+
 static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
 	.set_clock		= sdhci_at91_set_clock,
 	.set_bus_width		= sdhci_set_bus_width,
 	.reset			= sdhci_reset,
-	.set_uhs_signaling	= sdhci_set_uhs_signaling,
+	.set_uhs_signaling	= sdhci_at91_set_uhs_signaling,
 	.set_power		= sdhci_at91_set_power,
 };
 

[toc] | [prev] | [next] | [standalone]


#1617719 — [PATCH 4.10 11/81] xfs: allow unwritten extents in the CoW fork

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:20 +0200
Subject[PATCH 4.10 11/81] xfs: allow unwritten extents in the CoW fork
Message-ID<ttbK9-6Cm-1@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Darrick J. Wong <darrick.wong@oracle.com>

commit 05a630d76bd3f39baf0eecfa305bed2820796dee upstream.

In the data fork, we only allow extents to perform the following state
transitions:

delay -> real <-> unwritten

There's no way to move directly from a delalloc reservation to an
/unwritten/ allocated extent.  However, for the CoW fork we want to be
able to do the following to each extent:

delalloc -> unwritten -> written -> remapped to data fork

This will help us to avoid a race in the speculative CoW preallocation
code between a first thread that is allocating a CoW extent and a second
thread that is remapping part of a file after a write.  In order to do
this, however, we need two things: first, we have to be able to
transition from da to unwritten, and second the function that converts
between real and unwritten has to be made aware of the cow fork.  Do
both of those things.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/libxfs/xfs_bmap.c |   80 +++++++++++++++++++++++++++++------------------
 1 file changed, 50 insertions(+), 30 deletions(-)

--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1861,6 +1861,7 @@ xfs_bmap_add_extent_delay_real(
 		 */
 		trace_xfs_bmap_pre_update(bma->ip, bma->idx, state, _THIS_IP_);
 		xfs_bmbt_set_startblock(ep, new->br_startblock);
+		xfs_bmbt_set_state(ep, new->br_state);
 		trace_xfs_bmap_post_update(bma->ip, bma->idx, state, _THIS_IP_);
 
 		(*nextents)++;
@@ -2199,6 +2200,7 @@ STATIC int				/* error */
 xfs_bmap_add_extent_unwritten_real(
 	struct xfs_trans	*tp,
 	xfs_inode_t		*ip,	/* incore inode pointer */
+	int			whichfork,
 	xfs_extnum_t		*idx,	/* extent number to update/insert */
 	xfs_btree_cur_t		**curp,	/* if *curp is null, not a btree */
 	xfs_bmbt_irec_t		*new,	/* new data to add to file extents */
@@ -2218,12 +2220,14 @@ xfs_bmap_add_extent_unwritten_real(
 					/* left is 0, right is 1, prev is 2 */
 	int			rval=0;	/* return value (logging flags) */
 	int			state = 0;/* state bits, accessed thru macros */
-	struct xfs_mount	*mp = tp->t_mountp;
+	struct xfs_mount	*mp = ip->i_mount;
 
 	*logflagsp = 0;
 
 	cur = *curp;
-	ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
+	ifp = XFS_IFORK_PTR(ip, whichfork);
+	if (whichfork == XFS_COW_FORK)
+		state |= BMAP_COWFORK;
 
 	ASSERT(*idx >= 0);
 	ASSERT(*idx <= xfs_iext_count(ifp));
@@ -2282,7 +2286,7 @@ xfs_bmap_add_extent_unwritten_real(
 	 * Don't set contiguous if the combined extent would be too large.
 	 * Also check for all-three-contiguous being too large.
 	 */
-	if (*idx < xfs_iext_count(&ip->i_df) - 1) {
+	if (*idx < xfs_iext_count(ifp) - 1) {
 		state |= BMAP_RIGHT_VALID;
 		xfs_bmbt_get_all(xfs_iext_get_ext(ifp, *idx + 1), &RIGHT);
 		if (isnullstartblock(RIGHT.br_startblock))
@@ -2322,7 +2326,8 @@ xfs_bmap_add_extent_unwritten_real(
 		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
 
 		xfs_iext_remove(ip, *idx + 1, 2, state);
-		ip->i_d.di_nextents -= 2;
+		XFS_IFORK_NEXT_SET(ip, whichfork,
+				XFS_IFORK_NEXTENTS(ip, whichfork) - 2);
 		if (cur == NULL)
 			rval = XFS_ILOG_CORE | XFS_ILOG_DEXT;
 		else {
@@ -2365,7 +2370,8 @@ xfs_bmap_add_extent_unwritten_real(
 		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
 
 		xfs_iext_remove(ip, *idx + 1, 1, state);
-		ip->i_d.di_nextents--;
+		XFS_IFORK_NEXT_SET(ip, whichfork,
+				XFS_IFORK_NEXTENTS(ip, whichfork) - 1);
 		if (cur == NULL)
 			rval = XFS_ILOG_CORE | XFS_ILOG_DEXT;
 		else {
@@ -2400,7 +2406,8 @@ xfs_bmap_add_extent_unwritten_real(
 		xfs_bmbt_set_state(ep, newext);
 		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
 		xfs_iext_remove(ip, *idx + 1, 1, state);
-		ip->i_d.di_nextents--;
+		XFS_IFORK_NEXT_SET(ip, whichfork,
+				XFS_IFORK_NEXTENTS(ip, whichfork) - 1);
 		if (cur == NULL)
 			rval = XFS_ILOG_CORE | XFS_ILOG_DEXT;
 		else {
@@ -2512,7 +2519,8 @@ xfs_bmap_add_extent_unwritten_real(
 		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
 
 		xfs_iext_insert(ip, *idx, 1, new, state);
-		ip->i_d.di_nextents++;
+		XFS_IFORK_NEXT_SET(ip, whichfork,
+				XFS_IFORK_NEXTENTS(ip, whichfork) + 1);
 		if (cur == NULL)
 			rval = XFS_ILOG_CORE | XFS_ILOG_DEXT;
 		else {
@@ -2590,7 +2598,8 @@ xfs_bmap_add_extent_unwritten_real(
 		++*idx;
 		xfs_iext_insert(ip, *idx, 1, new, state);
 
-		ip->i_d.di_nextents++;
+		XFS_IFORK_NEXT_SET(ip, whichfork,
+				XFS_IFORK_NEXTENTS(ip, whichfork) + 1);
 		if (cur == NULL)
 			rval = XFS_ILOG_CORE | XFS_ILOG_DEXT;
 		else {
@@ -2638,7 +2647,8 @@ xfs_bmap_add_extent_unwritten_real(
 		++*idx;
 		xfs_iext_insert(ip, *idx, 2, &r[0], state);
 
-		ip->i_d.di_nextents += 2;
+		XFS_IFORK_NEXT_SET(ip, whichfork,
+				XFS_IFORK_NEXTENTS(ip, whichfork) + 2);
 		if (cur == NULL)
 			rval = XFS_ILOG_CORE | XFS_ILOG_DEXT;
 		else {
@@ -2692,17 +2702,17 @@ xfs_bmap_add_extent_unwritten_real(
 	}
 
 	/* update reverse mappings */
-	error = xfs_rmap_convert_extent(mp, dfops, ip, XFS_DATA_FORK, new);
+	error = xfs_rmap_convert_extent(mp, dfops, ip, whichfork, new);
 	if (error)
 		goto done;
 
 	/* convert to a btree if necessary */
-	if (xfs_bmap_needs_btree(ip, XFS_DATA_FORK)) {
+	if (xfs_bmap_needs_btree(ip, whichfork)) {
 		int	tmp_logflags;	/* partial log flag return val */
 
 		ASSERT(cur == NULL);
 		error = xfs_bmap_extents_to_btree(tp, ip, first, dfops, &cur,
-				0, &tmp_logflags, XFS_DATA_FORK);
+				0, &tmp_logflags, whichfork);
 		*logflagsp |= tmp_logflags;
 		if (error)
 			goto done;
@@ -2714,7 +2724,7 @@ xfs_bmap_add_extent_unwritten_real(
 		*curp = cur;
 	}
 
-	xfs_bmap_check_leaf_extents(*curp, ip, XFS_DATA_FORK);
+	xfs_bmap_check_leaf_extents(*curp, ip, whichfork);
 done:
 	*logflagsp |= rval;
 	return error;
@@ -4365,10 +4375,16 @@ xfs_bmapi_allocate(
 	bma->got.br_state = XFS_EXT_NORM;
 
 	/*
-	 * A wasdelay extent has been initialized, so shouldn't be flagged
-	 * as unwritten.
+	 * In the data fork, a wasdelay extent has been initialized, so
+	 * shouldn't be flagged as unwritten.
+	 *
+	 * For the cow fork, however, we convert delalloc reservations
+	 * (extents allocated for speculative preallocation) to
+	 * allocated unwritten extents, and only convert the unwritten
+	 * extents to real extents when we're about to write the data.
 	 */
-	if (!bma->wasdel && (bma->flags & XFS_BMAPI_PREALLOC) &&
+	if ((!bma->wasdel || (bma->flags & XFS_BMAPI_COWFORK)) &&
+	    (bma->flags & XFS_BMAPI_PREALLOC) &&
 	    xfs_sb_version_hasextflgbit(&mp->m_sb))
 		bma->got.br_state = XFS_EXT_UNWRITTEN;
 
@@ -4419,8 +4435,6 @@ xfs_bmapi_convert_unwritten(
 			(XFS_BMAPI_PREALLOC | XFS_BMAPI_CONVERT))
 		return 0;
 
-	ASSERT(whichfork != XFS_COW_FORK);
-
 	/*
 	 * Modify (by adding) the state flag, if writing.
 	 */
@@ -4445,8 +4459,8 @@ xfs_bmapi_convert_unwritten(
 			return error;
 	}
 
-	error = xfs_bmap_add_extent_unwritten_real(bma->tp, bma->ip, &bma->idx,
-			&bma->cur, mval, bma->firstblock, bma->dfops,
+	error = xfs_bmap_add_extent_unwritten_real(bma->tp, bma->ip, whichfork,
+			&bma->idx, &bma->cur, mval, bma->firstblock, bma->dfops,
 			&tmp_logflags);
 	/*
 	 * Log the inode core unconditionally in the unwritten extent conversion
@@ -4455,8 +4469,12 @@ xfs_bmapi_convert_unwritten(
 	 * in the transaction for the sake of fsync(), even if nothing has
 	 * changed, because fsync() will not force the log for this transaction
 	 * unless it sees the inode pinned.
+	 *
+	 * Note: If we're only converting cow fork extents, there aren't
+	 * any on-disk updates to make, so we don't need to log anything.
 	 */
-	bma->logflags |= tmp_logflags | XFS_ILOG_CORE;
+	if (whichfork != XFS_COW_FORK)
+		bma->logflags |= tmp_logflags | XFS_ILOG_CORE;
 	if (error)
 		return error;
 
@@ -4530,15 +4548,15 @@ xfs_bmapi_write(
 	ASSERT(*nmap >= 1);
 	ASSERT(*nmap <= XFS_BMAP_MAX_NMAP);
 	ASSERT(!(flags & XFS_BMAPI_IGSTATE));
-	ASSERT(tp != NULL);
+	ASSERT(tp != NULL ||
+	       (flags & (XFS_BMAPI_CONVERT | XFS_BMAPI_COWFORK)) ==
+			(XFS_BMAPI_CONVERT | XFS_BMAPI_COWFORK));
 	ASSERT(len > 0);
 	ASSERT(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL);
 	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 	ASSERT(!(flags & XFS_BMAPI_REMAP) || whichfork == XFS_DATA_FORK);
 	ASSERT(!(flags & XFS_BMAPI_PREALLOC) || !(flags & XFS_BMAPI_REMAP));
 	ASSERT(!(flags & XFS_BMAPI_CONVERT) || !(flags & XFS_BMAPI_REMAP));
-	ASSERT(!(flags & XFS_BMAPI_PREALLOC) || whichfork != XFS_COW_FORK);
-	ASSERT(!(flags & XFS_BMAPI_CONVERT) || whichfork != XFS_COW_FORK);
 
 	/* zeroing is for currently only for data extents, not metadata */
 	ASSERT((flags & (XFS_BMAPI_METADATA | XFS_BMAPI_ZERO)) !=
@@ -5553,8 +5571,8 @@ __xfs_bunmapi(
 			}
 			del.br_state = XFS_EXT_UNWRITTEN;
 			error = xfs_bmap_add_extent_unwritten_real(tp, ip,
-					&lastx, &cur, &del, firstblock, dfops,
-					&logflags);
+					whichfork, &lastx, &cur, &del,
+					firstblock, dfops, &logflags);
 			if (error)
 				goto error0;
 			goto nodelete;
@@ -5607,8 +5625,9 @@ __xfs_bunmapi(
 				prev.br_state = XFS_EXT_UNWRITTEN;
 				lastx--;
 				error = xfs_bmap_add_extent_unwritten_real(tp,
-						ip, &lastx, &cur, &prev,
-						firstblock, dfops, &logflags);
+						ip, whichfork, &lastx, &cur,
+						&prev, firstblock, dfops,
+						&logflags);
 				if (error)
 					goto error0;
 				goto nodelete;
@@ -5616,8 +5635,9 @@ __xfs_bunmapi(
 				ASSERT(del.br_state == XFS_EXT_NORM);
 				del.br_state = XFS_EXT_UNWRITTEN;
 				error = xfs_bmap_add_extent_unwritten_real(tp,
-						ip, &lastx, &cur, &del,
-						firstblock, dfops, &logflags);
+						ip, whichfork, &lastx, &cur,
+						&del, firstblock, dfops,
+						&logflags);
 				if (error)
 					goto error0;
 				goto nodelete;

[toc] | [prev] | [next] | [standalone]


#1617722 — [PATCH 4.10 18/81] xfs: handle indlen shortage on delalloc extent merge

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:20 +0200
Subject[PATCH 4.10 18/81] xfs: handle indlen shortage on delalloc extent merge
Message-ID<ttbK9-6Cm-7@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Brian Foster <bfoster@redhat.com>

commit 0e339ef8556d9e567aa7925f8892c263d79430d9 upstream.

When a delalloc extent is created, it can be merged with pre-existing,
contiguous, delalloc extents. When this occurs,
xfs_bmap_add_extent_hole_delay() merges the extents along with the
associated indirect block reservations. The expectation here is that the
combined worst case indlen reservation is always less than or equal to
the indlen reservation for the individual extents.

This is not always the case, however, as existing extents can less than
the expected indlen reservation if the extent was previously split due
to a hole punch. If a new extent merges with such an extent, the total
indlen requirement may be larger than the sum of the indlen reservations
held by both extents.

xfs_bmap_add_extent_hole_delay() assumes that the worst case indlen
reservation is always available and assigns it to the merged extent
without consideration for the indlen held by the pre-existing extent. As
a result, the subsequent xfs_mod_fdblocks() call can attempt an
unintentional allocation rather than a free (indicated by an ASSERT()
failure). Further, if the allocation happens to fail in this context,
the failure goes unhandled and creates a filesystem wide block
accounting inconsistency.

Fix xfs_bmap_add_extent_hole_delay() to function as designed. Cap the
indlen reservation assigned to the merged extent to the sum of the
indlen reservations held by each of the individual extents.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/libxfs/xfs_bmap.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -2816,7 +2816,8 @@ xfs_bmap_add_extent_hole_delay(
 		oldlen = startblockval(left.br_startblock) +
 			startblockval(new->br_startblock) +
 			startblockval(right.br_startblock);
-		newlen = xfs_bmap_worst_indlen(ip, temp);
+		newlen = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
+					 oldlen);
 		xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, *idx),
 			nullstartblock((int)newlen));
 		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
@@ -2837,7 +2838,8 @@ xfs_bmap_add_extent_hole_delay(
 		xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, *idx), temp);
 		oldlen = startblockval(left.br_startblock) +
 			startblockval(new->br_startblock);
-		newlen = xfs_bmap_worst_indlen(ip, temp);
+		newlen = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
+					 oldlen);
 		xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, *idx),
 			nullstartblock((int)newlen));
 		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
@@ -2853,7 +2855,8 @@ xfs_bmap_add_extent_hole_delay(
 		temp = new->br_blockcount + right.br_blockcount;
 		oldlen = startblockval(new->br_startblock) +
 			startblockval(right.br_startblock);
-		newlen = xfs_bmap_worst_indlen(ip, temp);
+		newlen = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
+					 oldlen);
 		xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, *idx),
 			new->br_startoff,
 			nullstartblock((int)newlen), temp, right.br_state);

[toc] | [prev] | [next] | [standalone]


#1617724 — [PATCH 4.10 16/81] xfs: correct null checks and error processing in xfs_initialize_perag

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:20 +0200
Subject[PATCH 4.10 16/81] xfs: correct null checks and error processing in xfs_initialize_perag
Message-ID<ttbKa-6Cm-13@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bill O'Donnell <billodo@redhat.com>

commit b20fe4730ea5c037c16631fb0df659c7b6d4b3b1 upstream.

If pag cannot be allocated, the current error exit path will trip
a null pointer deference error when calling xfs_buf_hash_destroy
with a null pag.  Fix this by adding a new error exit labels and
jumping to those accordingly, avoiding the hash destroy and
unnecessary kmem_free on pag.

Up to three things need to be properly unwound:

1) pag memory allocation
2) xfs_buf_hash_init
3) radix_tree_insert

For any given iteration through the loop, any of the above which
succeed must be unwound for /this/ pag, and then all prior
initialized pags must be unwound.

Addresses-Coverity-Id: 1397628 ("Dereference after null check")

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/xfs_mount.c |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -187,7 +187,7 @@ xfs_initialize_perag(
 	xfs_agnumber_t	*maxagi)
 {
 	xfs_agnumber_t	index;
-	xfs_agnumber_t	first_initialised = 0;
+	xfs_agnumber_t	first_initialised = NULLAGNUMBER;
 	xfs_perag_t	*pag;
 	int		error = -ENOMEM;
 
@@ -202,22 +202,20 @@ xfs_initialize_perag(
 			xfs_perag_put(pag);
 			continue;
 		}
-		if (!first_initialised)
-			first_initialised = index;
 
 		pag = kmem_zalloc(sizeof(*pag), KM_MAYFAIL);
 		if (!pag)
-			goto out_unwind;
+			goto out_unwind_new_pags;
 		pag->pag_agno = index;
 		pag->pag_mount = mp;
 		spin_lock_init(&pag->pag_ici_lock);
 		mutex_init(&pag->pag_ici_reclaim_lock);
 		INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
 		if (xfs_buf_hash_init(pag))
-			goto out_unwind;
+			goto out_free_pag;
 
 		if (radix_tree_preload(GFP_NOFS))
-			goto out_unwind;
+			goto out_hash_destroy;
 
 		spin_lock(&mp->m_perag_lock);
 		if (radix_tree_insert(&mp->m_perag_tree, index, pag)) {
@@ -225,10 +223,13 @@ xfs_initialize_perag(
 			spin_unlock(&mp->m_perag_lock);
 			radix_tree_preload_end();
 			error = -EEXIST;
-			goto out_unwind;
+			goto out_hash_destroy;
 		}
 		spin_unlock(&mp->m_perag_lock);
 		radix_tree_preload_end();
+		/* first new pag is fully initialized */
+		if (first_initialised == NULLAGNUMBER)
+			first_initialised = index;
 	}
 
 	index = xfs_set_inode_alloc(mp, agcount);
@@ -239,11 +240,16 @@ xfs_initialize_perag(
 	mp->m_ag_prealloc_blocks = xfs_prealloc_blocks(mp);
 	return 0;
 
-out_unwind:
+out_hash_destroy:
 	xfs_buf_hash_destroy(pag);
+out_free_pag:
 	kmem_free(pag);
-	for (; index > first_initialised; index--) {
+out_unwind_new_pags:
+	/* unwind any prior newly initialized pags */
+	for (index = first_initialised; index < agcount; index++) {
 		pag = radix_tree_delete(&mp->m_perag_tree, index);
+		if (!pag)
+			break;
 		xfs_buf_hash_destroy(pag);
 		kmem_free(pag);
 	}

[toc] | [prev] | [next] | [standalone]


#1617728 — [PATCH 4.10 10/81] xfs: verify free block header fields

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:20 +0200
Subject[PATCH 4.10 10/81] xfs: verify free block header fields
Message-ID<ttbKa-6Cm-21@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Darrick J. Wong <darrick.wong@oracle.com>

commit de14c5f541e78c59006bee56f6c5c2ef1ca07272 upstream.

Perform basic sanity checking of the directory free block header
fields so that we avoid hanging the system on invalid data.

(Granted that just means that now we shutdown on directory write,
but that seems better than hanging...)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/libxfs/xfs_dir2_node.c |   51 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

--- a/fs/xfs/libxfs/xfs_dir2_node.c
+++ b/fs/xfs/libxfs/xfs_dir2_node.c
@@ -155,6 +155,42 @@ const struct xfs_buf_ops xfs_dir3_free_b
 	.verify_write = xfs_dir3_free_write_verify,
 };
 
+/* Everything ok in the free block header? */
+static bool
+xfs_dir3_free_header_check(
+	struct xfs_inode	*dp,
+	xfs_dablk_t		fbno,
+	struct xfs_buf		*bp)
+{
+	struct xfs_mount	*mp = dp->i_mount;
+	unsigned int		firstdb;
+	int			maxbests;
+
+	maxbests = dp->d_ops->free_max_bests(mp->m_dir_geo);
+	firstdb = (xfs_dir2_da_to_db(mp->m_dir_geo, fbno) -
+		   xfs_dir2_byte_to_db(mp->m_dir_geo, XFS_DIR2_FREE_OFFSET)) *
+			maxbests;
+	if (xfs_sb_version_hascrc(&mp->m_sb)) {
+		struct xfs_dir3_free_hdr *hdr3 = bp->b_addr;
+
+		if (be32_to_cpu(hdr3->firstdb) != firstdb)
+			return false;
+		if (be32_to_cpu(hdr3->nvalid) > maxbests)
+			return false;
+		if (be32_to_cpu(hdr3->nvalid) < be32_to_cpu(hdr3->nused))
+			return false;
+	} else {
+		struct xfs_dir2_free_hdr *hdr = bp->b_addr;
+
+		if (be32_to_cpu(hdr->firstdb) != firstdb)
+			return false;
+		if (be32_to_cpu(hdr->nvalid) > maxbests)
+			return false;
+		if (be32_to_cpu(hdr->nvalid) < be32_to_cpu(hdr->nused))
+			return false;
+	}
+	return true;
+}
 
 static int
 __xfs_dir3_free_read(
@@ -168,11 +204,22 @@ __xfs_dir3_free_read(
 
 	err = xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp,
 				XFS_DATA_FORK, &xfs_dir3_free_buf_ops);
+	if (err || !*bpp)
+		return err;
+
+	/* Check things that we can't do in the verifier. */
+	if (!xfs_dir3_free_header_check(dp, fbno, *bpp)) {
+		xfs_buf_ioerror(*bpp, -EFSCORRUPTED);
+		xfs_verifier_error(*bpp);
+		xfs_trans_brelse(tp, *bpp);
+		return -EFSCORRUPTED;
+	}
 
 	/* try read returns without an error or *bpp if it lands in a hole */
-	if (!err && tp && *bpp)
+	if (tp)
 		xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_DIR_FREE_BUF);
-	return err;
+
+	return 0;
 }
 
 int

[toc] | [prev] | [next] | [standalone]


#1617732 — [PATCH 4.10 13/81] xfs: reset b_first_retry_time when clear the retry status of xfs_buf_t

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:20 +0200
Subject[PATCH 4.10 13/81] xfs: reset b_first_retry_time when clear the retry status of xfs_buf_t
Message-ID<ttbKa-6Cm-23@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hou Tao <houtao1@huawei.com>

commit 4dd2eb633598cb6a5a0be2fd9a2be0819f5eeb5f upstream.

After successful IO or permanent error, b_first_retry_time also
needs to be cleared, else the invalid first retry time will be
used by the next retry check.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/xfs_buf_item.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -1162,6 +1162,7 @@ xfs_buf_iodone_callbacks(
 	 */
 	bp->b_last_error = 0;
 	bp->b_retries = 0;
+	bp->b_first_retry_time = 0;
 
 	xfs_buf_do_callbacks(bp);
 	bp->b_fspriv = NULL;

[toc] | [prev] | [next] | [standalone]


#1617744 — [PATCH 4.10 15/81] xfs: update ctime and mtime on clone destinatation inodes

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 11:20 +0200
Subject[PATCH 4.10 15/81] xfs: update ctime and mtime on clone destinatation inodes
Message-ID<ttbKb-6Cm-53@gated-at.bofh.it>
In reply to#1617711
4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Christoph Hellwig <hch@lst.de>

commit c5ecb42342852892f978572ddc6dca703460f25a upstream.

We're changing both metadata and data, so we need to update the
timestamps for clone operations.  Dedupe on the other hand does
not change file data, and only changes invisible metadata so the
timestamps should not be updated.

This follows existing btrfs behavior.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
[darrick: remove redundant is_dedupe test]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/xfs_reflink.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -955,13 +955,14 @@ STATIC int
 xfs_reflink_update_dest(
 	struct xfs_inode	*dest,
 	xfs_off_t		newlen,
-	xfs_extlen_t		cowextsize)
+	xfs_extlen_t		cowextsize,
+	bool			is_dedupe)
 {
 	struct xfs_mount	*mp = dest->i_mount;
 	struct xfs_trans	*tp;
 	int			error;
 
-	if (newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0)
+	if (is_dedupe && newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0)
 		return 0;
 
 	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp);
@@ -982,6 +983,10 @@ xfs_reflink_update_dest(
 		dest->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE;
 	}
 
+	if (!is_dedupe) {
+		xfs_trans_ichgtime(tp, dest,
+				   XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
+	}
 	xfs_trans_log_inode(tp, dest, XFS_ILOG_CORE);
 
 	error = xfs_trans_commit(tp);
@@ -1295,7 +1300,8 @@ xfs_reflink_remap_range(
 	    !(dest->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
 		cowextsize = src->i_d.di_cowextsize;
 
-	ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize);
+	ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize,
+			is_dedupe);
 
 out_unlock:
 	xfs_iunlock(src, XFS_MMAPLOCK_EXCL);

[toc] | [prev] | [next] | [standalone]


#1618230

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-04-06 20:00 +0200
Message-ID<ttjRn-41h-1@gated-at.bofh.it>
In reply to#1617711
On 04/06/2017 02:37 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.10.9 release.
> There are 81 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sat Apr  8 08:36:05 UTC 2017.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.9-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

[toc] | [prev] | [next] | [standalone]


#1618240

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-06 20:10 +0200
Message-ID<ttk14-4lh-25@gated-at.bofh.it>
In reply to#1618230
On Thu, Apr 06, 2017 at 11:54:04AM -0600, Shuah Khan wrote:
> On 04/06/2017 02:37 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.10.9 release.
> > There are 81 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sat Apr  8 08:36:05 UTC 2017.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > 	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.9-rc1.gz
> > or in the git tree and branch at:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.10.y
> > and the diffstat can be found below.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> 
> Compiled and booted on my test system. No dmesg regressions.

Thanks for testing all of these and letting me know.

greg k-h

[toc] | [prev] | [next] | [standalone]


#1618373

FromGuenter Roeck <linux@roeck-us.net>
Date2017-04-07 00:00 +0200
Message-ID<ttnBE-6sT-23@gated-at.bofh.it>
In reply to#1617711
On Thu, Apr 06, 2017 at 10:37:52AM +0200, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.10.9 release.
> There are 81 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sat Apr  8 08:36:05 UTC 2017.
> Anything received after that time might be too late.
> 
Build results:
	total: 149 pass: 149 fail: 0
Qemu test results:
        total: 122 pass: 122 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

[toc] | [prev] | [next] | [standalone]


#1618568

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-07 10:20 +0200
Message-ID<ttxhE-4AV-25@gated-at.bofh.it>
In reply to#1618373
On Thu, Apr 06, 2017 at 02:53:01PM -0700, Guenter Roeck wrote:
> On Thu, Apr 06, 2017 at 10:37:52AM +0200, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.10.9 release.
> > There are 81 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sat Apr  8 08:36:05 UTC 2017.
> > Anything received after that time might be too late.
> > 
> Build results:
> 	total: 149 pass: 149 fail: 0
> Qemu test results:
>         total: 122 pass: 122 fail: 0
> 
> Details are available at http://kerneltests.org/builders.

Thanks for testing all of these and letting me know.

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web