Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 27 Jul 2016 01:35:55 +0000 (18:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 27 Jul 2016 01:35:55 +0000 (18:35 -0700)
Pull ext4 updates from Ted Ts'o:
 "The major change this cycle is deleting ext4's copy of the file system
  encryption code and switching things over to using the copies in
  fs/crypto.  I've updated the MAINTAINERS file to add an entry for
  fs/crypto listing Jaeguk Kim and myself as the maintainers.

  There are also a number of bug fixes, most notably for some problems
  found by American Fuzzy Lop (AFL) courtesy of Vegard Nossum.  Also
  fixed is a writeback deadlock detected by generic/130, and some
  potential races in the metadata checksum code"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (21 commits)
  ext4: verify extent header depth
  ext4: short-cut orphan cleanup on error
  ext4: fix reference counting bug on block allocation error
  MAINTAINRES: fs-crypto maintainers update
  ext4 crypto: migrate into vfs's crypto engine
  ext2: fix filesystem deadlock while reading corrupted xattr block
  ext4: fix project quota accounting without quota limits enabled
  ext4: validate s_reserved_gdt_blocks on mount
  ext4: remove unused page_idx
  ext4: don't call ext4_should_journal_data() on the journal inode
  ext4: Fix WARN_ON_ONCE in ext4_commit_super()
  ext4: fix deadlock during page writeback
  ext4: correct error value of function verifying dx checksum
  ext4: avoid modifying checksum fields directly during checksum verification
  ext4: check for extents that wrap around
  jbd2: make journal y2038 safe
  jbd2: track more dependencies on transaction commit
  jbd2: move lockdep tracking to journal_s
  jbd2: move lockdep instrumentation for jbd2 handles
  ext4: respect the nobarrier mount option in nojournal mode
  ...

1  2 
MAINTAINERS
fs/ext4/balloc.c
fs/ext4/ialloc.c
fs/ext4/inode.c
fs/ext4/namei.c
fs/ext4/page-io.c
fs/ext4/readpage.c
fs/ext4/super.c
fs/jbd2/commit.c
fs/jbd2/journal.c

diff --combined MAINTAINERS
@@@ -288,7 -288,6 +288,7 @@@ F: include/linux/acpi.
  F:    include/acpi/
  F:    Documentation/acpi/
  F:    Documentation/ABI/testing/sysfs-bus-acpi
 +F:    Documentation/ABI/testing/configfs-acpi
  F:    drivers/pci/*acpi*
  F:    drivers/pci/*/*acpi*
  F:    drivers/pci/*/*/*acpi*
@@@ -596,10 -595,6 +596,10 @@@ S:       Odd Fixe
  L:    linux-alpha@vger.kernel.org
  F:    arch/alpha/
  
 +ALPS PS/2 TOUCHPAD DRIVER
 +R:    Pali Rohár <pali.rohar@gmail.com>
 +F:    drivers/input/mouse/alps.*
 +
  ALTERA MAILBOX DRIVER
  M:    Ley Foon Tan <lftan@altera.com>
  L:    nios2-dev@lists.rocketboards.org (moderated for non-subscribers)
@@@ -1164,7 -1159,6 +1164,7 @@@ F:      arch/arm/mach-footbridge
  ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
  M:    Shawn Guo <shawnguo@kernel.org>
  M:    Sascha Hauer <kernel@pengutronix.de>
 +R:    Fabio Estevam <fabio.estevam@nxp.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git
@@@ -1670,6 -1664,7 +1670,6 @@@ F:      arch/arm/boot/dts/sh
  F:    arch/arm/configs/shmobile_defconfig
  F:    arch/arm/include/debug/renesas-scif.S
  F:    arch/arm/mach-shmobile/
 -F:    drivers/sh/
  F:    drivers/soc/renesas/
  F:    include/linux/soc/renesas/
  
@@@ -1694,6 -1689,8 +1694,6 @@@ S:      Maintaine
  F:    drivers/edac/altera_edac.
  
  ARM/STI ARCHITECTURE
 -M:    Srinivas Kandagatla <srinivas.kandagatla@gmail.com>
 -M:    Maxime Coquelin <maxime.coquelin@st.com>
  M:    Patrice Chotard <patrice.chotard@st.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  L:    kernel@stlinux.com
@@@ -1726,7 -1723,6 +1726,7 @@@ F:      drivers/ata/ahci_st.
  
  ARM/STM32 ARCHITECTURE
  M:    Maxime Coquelin <mcoquelin.stm32@gmail.com>
 +M:    Alexandre Torgue <alexandre.torgue@st.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mcoquelin/stm32.git
@@@ -2246,8 -2242,7 +2246,8 @@@ F:      include/net/ax25.
  F:    net/ax25/
  
  AZ6007 DVB DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -2714,8 -2709,7 +2714,8 @@@ F:      Documentation/filesystems/btrfs.tx
  F:    fs/btrfs/
  
  BTTV VIDEO4LINUX DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -2779,9 -2773,9 +2779,9 @@@ F:      include/net/caif
  F:    net/caif/
  
  CALGARY x86-64 IOMMU
 -M:    Muli Ben-Yehuda <muli@il.ibm.com>
 -M:    "Jon D. Mason" <jdmason@kudzu.us>
 -L:    discuss@x86-64.org
 +M:    Muli Ben-Yehuda <mulix@mulix.org>
 +M:    Jon Mason <jdmason@kudzu.us>
 +L:    iommu@lists.linux-foundation.org
  S:    Maintained
  F:    arch/x86/kernel/pci-calgary_64.c
  F:    arch/x86/kernel/tce_64.c
@@@ -3092,7 -3086,6 +3092,7 @@@ M:      Stephen Boyd <sboyd@codeaurora.org
  L:    linux-clk@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/clock/
  F:    drivers/clk/
  X:    drivers/clk/clkdev.c
  F:    include/linux/clk-pr*
@@@ -3287,7 -3280,6 +3287,7 @@@ T:      git git://git.kernel.org/pub/scm/lin
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git
  S:    Maintained
  F:    Documentation/crypto/
 +F:    Documentation/devicetree/bindings/crypto/
  F:    Documentation/DocBook/crypto-API.tmpl
  F:    arch/*/crypto/
  F:    crypto/
@@@ -3351,8 -3343,7 +3351,8 @@@ S:      Maintaine
  F:    drivers/media/dvb-frontends/cx24120*
  
  CX88 VIDEO4LINUX DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -3782,7 -3773,6 +3782,7 @@@ Q:      https://patchwork.kernel.org/project
  S:    Maintained
  F:    drivers/dma/
  F:    include/linux/dmaengine.h
 +F:    Documentation/devicetree/bindings/dma/
  F:    Documentation/dmaengine/
  T:    git git://git.infradead.org/users/vkoul/slave-dma.git
  
@@@ -4300,8 -4290,7 +4300,8 @@@ F:      fs/ecryptfs
  EDAC-CORE
  M:    Doug Thompson <dougthompson@xmission.com>
  M:    Borislav Petkov <bp@alien8.de>
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-edac@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac.git linux_next
@@@ -4346,8 -4335,7 +4346,8 @@@ S:      Maintaine
  F:    drivers/edac/e7xxx_edac.c
  
  EDAC-GHES
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-edac@vger.kernel.org
  S:    Maintained
  F:    drivers/edac/ghes_edac.c
@@@ -4371,22 -4359,19 +4371,22 @@@ S:   Maintaine
  F:    drivers/edac/i5000_edac.c
  
  EDAC-I5400
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-edac@vger.kernel.org
  S:    Maintained
  F:    drivers/edac/i5400_edac.c
  
  EDAC-I7300
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-edac@vger.kernel.org
  S:    Maintained
  F:    drivers/edac/i7300_edac.c
  
  EDAC-I7CORE
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-edac@vger.kernel.org
  S:    Maintained
  F:    drivers/edac/i7core_edac.c
@@@ -4423,8 -4408,7 +4423,8 @@@ S:      Maintaine
  F:    drivers/edac/r82600_edac.c
  
  EDAC-SBRIDGE
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-edac@vger.kernel.org
  S:    Maintained
  F:    drivers/edac/sb_edac.c
@@@ -4477,14 -4461,13 +4477,14 @@@ S:   Orpha
  F:    fs/efs/
  
  EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER
 -M:    Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
 +M:    Douglas Miller <dougmill@linux.vnet.ibm.com>
  L:    netdev@vger.kernel.org
  S:    Maintained
  F:    drivers/net/ethernet/ibm/ehea/
  
  EM28XX VIDEO4LINUX DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -4942,6 -4925,13 +4942,13 @@@ F:    Documentation/filesystems/caching
  F:    fs/fscache/
  F:    include/linux/fscache*.h
  
+ FS-CRYPTO: FILE SYSTEM LEVEL ENCRYPTION SUPPORT
+ M:    Theodore Y. Ts'o <tytso@mit.edu>
+ M:    Jaegeuk Kim <jaegeuk@kernel.org>
+ S:    Supported
+ F:    fs/crypto/
+ F:    include/linux/fscrypto.h
  F2FS FILE SYSTEM
  M:    Jaegeuk Kim <jaegeuk@kernel.org>
  M:    Changman Lee <cm224.lee@samsung.com>
@@@ -5275,7 -5265,6 +5282,7 @@@ M:      Matt Mackall <mpm@selenic.com
  M:    Herbert Xu <herbert@gondor.apana.org.au>
  L:    linux-crypto@vger.kernel.org
  S:    Odd fixes
 +F:    Documentation/devicetree/bindings/rng/
  F:    Documentation/hw_random.txt
  F:    drivers/char/hw_random/
  F:    include/linux/hw_random.h
@@@ -5790,9 -5779,7 +5797,9 @@@ R:      Hartmut Knaack <knaack.h@gmx.de
  R:    Lars-Peter Clausen <lars@metafoo.de>
  R:    Peter Meerwald-Stadler <pmeerw@pmeerw.net>
  L:    linux-iio@vger.kernel.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/iio/
  F:    drivers/iio/
  F:    drivers/staging/iio/
  F:    include/linux/iio/
@@@ -5922,12 -5909,6 +5929,12 @@@ L:    platform-driver-x86@vger.kernel.or
  S:    Maintained
  F:    drivers/platform/x86/intel-hid.c
  
 +INTEL VIRTUAL BUTTON DRIVER
 +M:    AceLan Kao <acelan.kao@canonical.com>
 +L:    platform-driver-x86@vger.kernel.org
 +S:    Maintained
 +F:    drivers/platform/x86/intel-vbtn.c
 +
  INTEL IDLE DRIVER
  M:    Len Brown <lenb@kernel.org>
  L:    linux-pm@vger.kernel.org
@@@ -6244,6 -6225,7 +6251,6 @@@ F:      Documentation/devicetree/bindings/in
  F:    drivers/irqchip/
  
  IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
 -M:    Jiang Liu <jiang.liu@linux.intel.com>
  M:    Marc Zyngier <marc.zyngier@arm.com>
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
@@@ -6511,7 -6493,6 +6518,7 @@@ F:      include/uapi/linux/sunrpc
  
  KERNEL SELFTEST FRAMEWORK
  M:    Shuah Khan <shuahkh@osg.samsung.com>
 +M:    Shuah Khan <shuah@kernel.org>
  L:    linux-kselftest@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/shuah/linux-kselftest
  S:    Maintained
@@@ -6775,7 -6756,6 +6782,7 @@@ S:      Maintaine
  F:    drivers/ata/
  F:    include/linux/ata.h
  F:    include/linux/libata.h
 +F:    Documentation/devicetree/bindings/ata/
  
  LIBATA PATA ARASAN COMPACT FLASH CONTROLLER
  M:    Viresh Kumar <vireshk@kernel.org>
@@@ -6980,7 -6960,7 +6987,7 @@@ T:      git git://git.kernel.org/pub/scm/lin
  LINUX KERNEL DUMP TEST MODULE (LKDTM)
  M:    Kees Cook <keescook@chromium.org>
  S:    Maintained
 -F:    drivers/misc/lkdtm.c
 +F:    drivers/misc/lkdtm*
  
  LLC (802.2)
  M:    Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
@@@ -7033,23 -7013,15 +7040,23 @@@ Q:   http://patchwork.linuxtv.org/project
  S:    Maintained
  F:    drivers/media/usb/dvb-usb-v2/lmedm04*
  
 -LOCKDEP AND LOCKSTAT
 +LOCKING PRIMITIVES
  M:    Peter Zijlstra <peterz@infradead.org>
  M:    Ingo Molnar <mingo@redhat.com>
  L:    linux-kernel@vger.kernel.org
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/locking
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
  S:    Maintained
 -F:    Documentation/locking/lockdep*.txt
 -F:    Documentation/locking/lockstat.txt
 +F:    Documentation/locking/
  F:    include/linux/lockdep.h
 +F:    include/linux/spinlock*.h
 +F:    arch/*/include/asm/spinlock*.h
 +F:    include/linux/rwlock*.h
 +F:    include/linux/mutex*.h
 +F:    arch/*/include/asm/mutex*.h
 +F:    include/linux/rwsem*.h
 +F:    arch/*/include/asm/rwsem.h
 +F:    include/linux/seqlock.h
 +F:    lib/locking*.[ch]
  F:    kernel/locking/
  
  LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks)
@@@ -7392,8 -7364,7 +7399,8 @@@ S:      Supporte
  F:    drivers/media/pci/netup_unidvb/*
  
  MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  P:    LinuxTV.org Project
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
@@@ -7441,7 -7412,7 +7448,7 @@@ F:      drivers/scsi/megaraid.
  F:    drivers/scsi/megaraid/
  
  MELLANOX ETHERNET DRIVER (mlx4_en)
 -M:    Eugenia Emantayev <eugenia@mellanox.com>
 +M:    Tariq Toukan <tariqt@mellanox.com>
  L:    netdev@vger.kernel.org
  S:    Supported
  W:    http://www.mellanox.com
@@@ -7493,7 -7464,6 +7500,7 @@@ Q:      http://patchwork.ozlabs.org/project/
  T:    git git://git.infradead.org/linux-mtd.git
  T:    git git://git.infradead.org/l2-mtd.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/mtd/
  F:    drivers/mtd/
  F:    include/linux/mtd/
  F:    include/uapi/mtd/
@@@ -8026,7 -7996,6 +8033,7 @@@ Q:      http://patchwork.ozlabs.org/project/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
  S:    Odd Fixes
 +F:    Documentation/devicetree/bindings/net/
  F:    drivers/net/
  F:    include/linux/if_*
  F:    include/linux/netdevice.h
@@@ -8045,7 -8014,6 +8052,7 @@@ Q:      http://patchwork.kernel.org/project/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/net/wireless/
  F:    drivers/net/wireless/
  
  NETXEN (1/10) GbE SUPPORT
@@@ -8191,13 -8159,6 +8198,13 @@@ S:    Supporte
  F:    drivers/nvme/host/
  F:    include/linux/nvme.h
  
 +NVM EXPRESS TARGET DRIVER
 +M:    Christoph Hellwig <hch@lst.de>
 +M:    Sagi Grimberg <sagi@grimberg.me>
 +L:    linux-nvme@lists.infradead.org
 +S:    Supported
 +F:    drivers/nvme/target/
 +
  NVMEM FRAMEWORK
  M:    Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
  M:    Maxime Ripard <maxime.ripard@free-electrons.com>
@@@ -8450,9 -8411,10 +8457,9 @@@ F:     drivers/i2c/busses/i2c-ocores.
  OPEN FIRMWARE AND FLATTENED DEVICE TREE
  M:    Rob Herring <robh+dt@kernel.org>
  M:    Frank Rowand <frowand.list@gmail.com>
 -M:    Grant Likely <grant.likely@linaro.org>
  L:    devicetree@vger.kernel.org
  W:    http://www.devicetree.org/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
  S:    Maintained
  F:    drivers/of/
  F:    include/linux/of*.h
@@@ -8460,10 -8422,12 +8467,10 @@@ F:   scripts/dtc
  
  OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
  M:    Rob Herring <robh+dt@kernel.org>
 -M:    Pawel Moll <pawel.moll@arm.com>
  M:    Mark Rutland <mark.rutland@arm.com>
 -M:    Ian Campbell <ijc+devicetree@hellion.org.uk>
 -M:    Kumar Gala <galak@codeaurora.org>
  L:    devicetree@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
 +Q:    http://patchwork.ozlabs.org/project/devicetree-bindings/list/
  S:    Maintained
  F:    Documentation/devicetree/
  F:    arch/*/boot/dts/
@@@ -8987,8 -8951,6 +8994,8 @@@ M:      Linus Walleij <linus.walleij@linaro.
  L:    linux-gpio@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/pinctrl/
 +F:    Documentation/pinctrl.txt
  F:    drivers/pinctrl/
  F:    include/linux/pinctrl/
  
@@@ -9335,8 -9297,7 +9342,8 @@@ L:      rtc-linux@googlegroups.co
  S:    Maintained
  
  QAT DRIVER
 -M:    Tadeusz Struk <tadeusz.struk@intel.com>
 +M:    Giovanni Cabiddu <giovanni.cabiddu@intel.com>
 +M:    Salvatore Benedetto <salvatore.benedetto@intel.com>
  L:    qat-linux@intel.com
  S:    Supported
  F:    drivers/crypto/qat/
@@@ -9897,8 -9858,7 +9904,8 @@@ S:      Odd Fixe
  F:    drivers/media/i2c/saa6588*
  
  SAA7134 VIDEO4LINUX DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -10027,7 -9987,6 +10034,7 @@@ SERIAL DRIVER
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  L:    linux-serial@vger.kernel.org
  S:    Maintained
 +F:    Documentation/devicetree/bindings/serial/
  F:    drivers/tty/serial/
  
  SYNOPSYS DESIGNWARE DMAC DRIVER
@@@ -10418,8 -10377,7 +10425,8 @@@ S:   Maintaine
  F:    drivers/media/radio/si4713/radio-usb-si4713.c
  
  SIANO DVB DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -10888,7 -10846,6 +10895,7 @@@ STAGING - INDUSTRIAL I
  M:    Jonathan Cameron <jic23@kernel.org>
  L:    linux-iio@vger.kernel.org
  S:    Odd Fixes
 +F:    Documentation/devicetree/bindings/staging/iio/
  F:    drivers/staging/iio/
  
  STAGING - LIRC (LINUX INFRARED REMOTE CONTROL) DRIVERS
@@@ -11186,8 -11143,7 +11193,8 @@@ S:   Maintaine
  F:    drivers/media/i2c/tda9840*
  
  TEA5761 TUNER DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -11195,8 -11151,7 +11202,8 @@@ S:   Odd fixe
  F:    drivers/media/tuners/tea5761.*
  
  TEA5767 TUNER DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -11583,8 -11538,7 +11590,8 @@@ F:   include/linux/shmem_fs.
  F:    mm/shmem.c
  
  TM6000 VIDEO4LINUX DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
@@@ -11938,8 -11892,7 +11945,8 @@@ F:   drivers/usb/common/usb-otg-fsm.
  
  USB OVER IP DRIVER
  M:    Valentina Manea <valentina.manea.m@gmail.com>
 -M:    Shuah Khan <shuah.kh@samsung.com>
 +M:    Shuah Khan <shuahkh@osg.samsung.com>
 +M:    Shuah Khan <shuah@kernel.org>
  L:    linux-usb@vger.kernel.org
  S:    Maintained
  F:    Documentation/usb/usbip_protocol.txt
@@@ -12010,7 -11963,6 +12017,7 @@@ L:   linux-usb@vger.kernel.or
  W:    http://www.linux-usb.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
  S:    Supported
 +F:    Documentation/devicetree/bindings/usb/
  F:    Documentation/usb/
  F:    drivers/usb/
  F:    include/linux/usb.h
@@@ -12184,7 -12136,6 +12191,7 @@@ VIRTIO CORE, NET AND BLOCK DRIVER
  M:    "Michael S. Tsirkin" <mst@redhat.com>
  L:    virtualization@lists.linux-foundation.org
  S:    Maintained
 +F:    Documentation/devicetree/bindings/virtio/
  F:    drivers/virtio/
  F:    tools/virtio/
  F:    drivers/net/virtio_net.c
@@@ -12573,8 -12524,7 +12580,8 @@@ S:   Maintaine
  F:    arch/x86/entry/vdso/
  
  XC2028/3028 TUNER DRIVER
 -M:    Mauro Carvalho Chehab <mchehab@osg.samsung.com>
 +M:    Mauro Carvalho Chehab <mchehab@s-opensource.com>
 +M:    Mauro Carvalho Chehab <mchehab@kernel.org>
  L:    linux-media@vger.kernel.org
  W:    https://linuxtv.org
  T:    git git://linuxtv.org/media_tree.git
diff --combined fs/ext4/balloc.c
@@@ -208,6 -208,9 +208,9 @@@ static int ext4_init_block_bitmap(struc
        memset(bh->b_data, 0, sb->s_blocksize);
  
        bit_max = ext4_num_base_meta_clusters(sb, block_group);
+       if ((bit_max >> 3) >= bh->b_size)
+               return -EFSCORRUPTED;
        for (bit = 0; bit < bit_max; bit++)
                ext4_set_bit(bit, bh->b_data);
  
@@@ -470,7 -473,7 +473,7 @@@ ext4_read_block_bitmap_nowait(struct su
        trace_ext4_read_block_bitmap_load(sb, block_group);
        bh->b_end_io = ext4_end_bitmap_read;
        get_bh(bh);
 -      submit_bh(READ | REQ_META | REQ_PRIO, bh);
 +      submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
        return bh;
  verify:
        err = ext4_validate_block_bitmap(sb, desc, block_group, bh);
@@@ -610,7 -613,9 +613,9 @@@ int ext4_should_retry_alloc(struct supe
  
        jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
  
-       jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal);
+       smp_mb();
+       if (EXT4_SB(sb)->s_mb_free_pending)
+               jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal);
        return 1;
  }
  
diff --combined fs/ext4/ialloc.c
@@@ -214,7 -214,7 +214,7 @@@ ext4_read_inode_bitmap(struct super_blo
        trace_ext4_load_inode_bitmap(sb, block_group);
        bh->b_end_io = ext4_end_bitmap_read;
        get_bh(bh);
 -      submit_bh(READ | REQ_META | REQ_PRIO, bh);
 +      submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
        wait_on_buffer(bh);
        if (!buffer_uptodate(bh)) {
                put_bh(bh);
@@@ -767,10 -767,10 +767,10 @@@ struct inode *__ext4_new_inode(handle_
        if ((ext4_encrypted_inode(dir) ||
             DUMMY_ENCRYPTION_ENABLED(EXT4_SB(dir->i_sb))) &&
            (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) {
-               err = ext4_get_encryption_info(dir);
+               err = fscrypt_get_encryption_info(dir);
                if (err)
                        return ERR_PTR(err);
-               if (ext4_encryption_info(dir) == NULL)
+               if (!fscrypt_has_encryption_key(dir))
                        return ERR_PTR(-EPERM);
                if (!handle)
                        nblocks += EXT4_DATA_TRANS_BLOCKS(dir->i_sb);
@@@ -1115,7 -1115,8 +1115,8 @@@ got
        }
  
        if (encrypt) {
-               err = ext4_inherit_context(dir, inode);
+               /* give pointer to avoid set_context with journal ops. */
+               err = fscrypt_inherit_context(dir, inode, &encrypt, true);
                if (err)
                        goto fail_free_drop;
        }
diff --combined fs/ext4/inode.c
@@@ -51,26 -51,32 +51,32 @@@ static __u32 ext4_inode_csum(struct ino
                              struct ext4_inode_info *ei)
  {
        struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
-       __u16 csum_lo;
-       __u16 csum_hi = 0;
        __u32 csum;
-       csum_lo = le16_to_cpu(raw->i_checksum_lo);
-       raw->i_checksum_lo = 0;
-       if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
-           EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) {
-               csum_hi = le16_to_cpu(raw->i_checksum_hi);
-               raw->i_checksum_hi = 0;
+       __u16 dummy_csum = 0;
+       int offset = offsetof(struct ext4_inode, i_checksum_lo);
+       unsigned int csum_size = sizeof(dummy_csum);
+       csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)raw, offset);
+       csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum, csum_size);
+       offset += csum_size;
+       csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
+                          EXT4_GOOD_OLD_INODE_SIZE - offset);
+       if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
+               offset = offsetof(struct ext4_inode, i_checksum_hi);
+               csum = ext4_chksum(sbi, csum, (__u8 *)raw +
+                                  EXT4_GOOD_OLD_INODE_SIZE,
+                                  offset - EXT4_GOOD_OLD_INODE_SIZE);
+               if (EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) {
+                       csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum,
+                                          csum_size);
+                       offset += csum_size;
+                       csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
+                                          EXT4_INODE_SIZE(inode->i_sb) -
+                                          offset);
+               }
        }
  
-       csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)raw,
-                          EXT4_INODE_SIZE(inode->i_sb));
-       raw->i_checksum_lo = cpu_to_le16(csum_lo);
-       if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
-           EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi))
-               raw->i_checksum_hi = cpu_to_le16(csum_hi);
        return csum;
  }
  
@@@ -205,9 -211,9 +211,9 @@@ void ext4_evict_inode(struct inode *ino
                 * Note that directories do not have this problem because they
                 * don't use page cache.
                 */
-               if (ext4_should_journal_data(inode) &&
-                   (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
-                   inode->i_ino != EXT4_JOURNAL_INO) {
+               if (inode->i_ino != EXT4_JOURNAL_INO &&
+                   ext4_should_journal_data(inode) &&
+                   (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
                        journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
                        tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
  
@@@ -386,7 -392,7 +392,7 @@@ int ext4_issue_zeroout(struct inode *in
        int ret;
  
        if (ext4_encrypted_inode(inode))
-               return ext4_encrypted_zeroout(inode, lblk, pblk, len);
+               return fscrypt_zeroout_range(inode, lblk, pblk, len);
  
        ret = sb_issue_zeroout(inode->i_sb, pblk, len, GFP_NOFS);
        if (ret > 0)
@@@ -981,7 -987,7 +987,7 @@@ struct buffer_head *ext4_bread(handle_
                return bh;
        if (!bh || buffer_uptodate(bh))
                return bh;
 -      ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
 +      ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &bh);
        wait_on_buffer(bh);
        if (buffer_uptodate(bh))
                return bh;
@@@ -1135,7 -1141,7 +1141,7 @@@ static int ext4_block_write_begin(struc
                if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
                    !buffer_unwritten(bh) &&
                    (block_start < from || block_end > to)) {
 -                      ll_rw_block(READ, 1, &bh);
 +                      ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                        *wait_bh++ = bh;
                        decrypt = ext4_encrypted_inode(inode) &&
                                S_ISREG(inode->i_mode);
        if (unlikely(err))
                page_zero_new_buffers(page, from, to);
        else if (decrypt)
-               err = ext4_decrypt(page);
+               err = fscrypt_decrypt_page(page);
        return err;
  }
  #endif
@@@ -2748,13 -2754,36 +2754,36 @@@ retry
                                done = true;
                        }
                }
-               ext4_journal_stop(handle);
+               /*
+                * Caution: If the handle is synchronous,
+                * ext4_journal_stop() can wait for transaction commit
+                * to finish which may depend on writeback of pages to
+                * complete or on page lock to be released.  In that
+                * case, we have to wait until after after we have
+                * submitted all the IO, released page locks we hold,
+                * and dropped io_end reference (for extent conversion
+                * to be able to complete) before stopping the handle.
+                */
+               if (!ext4_handle_valid(handle) || handle->h_sync == 0) {
+                       ext4_journal_stop(handle);
+                       handle = NULL;
+               }
                /* Submit prepared bio */
                ext4_io_submit(&mpd.io_submit);
                /* Unlock pages we didn't use */
                mpage_release_unused_pages(&mpd, give_up_on_write);
-               /* Drop our io_end reference we got from init */
-               ext4_put_io_end(mpd.io_submit.io_end);
+               /*
+                * Drop our io_end reference we got from init. We have
+                * to be careful and use deferred io_end finishing if
+                * we are still holding the transaction as we can
+                * release the last reference to io_end which may end
+                * up doing unwritten extent conversion.
+                */
+               if (handle) {
+                       ext4_put_io_end_defer(mpd.io_submit.io_end);
+                       ext4_journal_stop(handle);
+               } else
+                       ext4_put_io_end(mpd.io_submit.io_end);
  
                if (ret == -ENOSPC && sbi->s_journal) {
                        /*
@@@ -3698,7 -3727,7 +3727,7 @@@ static int __ext4_block_zero_page_range
  
        if (!buffer_uptodate(bh)) {
                err = -EIO;
 -              ll_rw_block(READ, 1, &bh);
 +              ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                wait_on_buffer(bh);
                /* Uhhuh. Read error. Complain and punt. */
                if (!buffer_uptodate(bh))
                if (S_ISREG(inode->i_mode) &&
                    ext4_encrypted_inode(inode)) {
                        /* We expect the key to be set. */
-                       BUG_ON(!ext4_has_encryption_key(inode));
+                       BUG_ON(!fscrypt_has_encryption_key(inode));
                        BUG_ON(blocksize != PAGE_SIZE);
-                       WARN_ON_ONCE(ext4_decrypt(page));
+                       WARN_ON_ONCE(fscrypt_decrypt_page(page));
                }
        }
        if (ext4_should_journal_data(inode)) {
@@@ -4281,7 -4310,7 +4310,7 @@@ make_io
                trace_ext4_load_inode(inode);
                get_bh(bh);
                bh->b_end_io = end_buffer_read_sync;
 -              submit_bh(READ | REQ_META | REQ_PRIO, bh);
 +              submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
                wait_on_buffer(bh);
                if (!buffer_uptodate(bh)) {
                        EXT4_ERROR_INODE_BLOCK(inode, block,
diff --combined fs/ext4/namei.c
@@@ -420,15 -420,14 +420,14 @@@ static __le32 ext4_dx_csum(struct inod
        struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
        struct ext4_inode_info *ei = EXT4_I(inode);
        __u32 csum;
-       __le32 save_csum;
        int size;
+       __u32 dummy_csum = 0;
+       int offset = offsetof(struct dx_tail, dt_checksum);
  
        size = count_offset + (count * sizeof(struct dx_entry));
-       save_csum = t->dt_checksum;
-       t->dt_checksum = 0;
        csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)dirent, size);
-       csum = ext4_chksum(sbi, csum, (__u8 *)t, sizeof(struct dx_tail));
-       t->dt_checksum = save_csum;
+       csum = ext4_chksum(sbi, csum, (__u8 *)t, offset);
+       csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum, sizeof(dummy_csum));
  
        return cpu_to_le32(csum);
  }
@@@ -446,14 -445,14 +445,14 @@@ static int ext4_dx_csum_verify(struct i
        c = get_dx_countlimit(inode, dirent, &count_offset);
        if (!c) {
                EXT4_ERROR_INODE(inode, "dir seems corrupt?  Run e2fsck -D.");
-               return 1;
+               return 0;
        }
        limit = le16_to_cpu(c->limit);
        count = le16_to_cpu(c->count);
        if (count_offset + (limit * sizeof(struct dx_entry)) >
            EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
                warn_no_space_for_csum(inode);
-               return 1;
+               return 0;
        }
        t = (struct dx_tail *)(((struct dx_entry *)c) + limit);
  
@@@ -612,19 -611,19 +611,19 @@@ static struct stats dx_show_leaf(struc
  #ifdef CONFIG_EXT4_FS_ENCRYPTION
                                int len;
                                char *name;
-                               struct ext4_str fname_crypto_str
-                                       = {.name = NULL, .len = 0};
+                               struct fscrypt_str fname_crypto_str =
+                                       FSTR_INIT(NULL, 0);
                                int res = 0;
  
                                name  = de->name;
                                len = de->name_len;
-                               if (ext4_encrypted_inode(inode))
-                                       res = ext4_get_encryption_info(dir);
+                               if (ext4_encrypted_inode(dir))
+                                       res = fscrypt_get_encryption_info(dir);
                                if (res) {
                                        printk(KERN_WARNING "Error setting up"
                                               " fname crypto: %d\n", res);
                                }
-                               if (ctx == NULL) {
+                               if (!fscrypt_has_encryption_key(dir)) {
                                        /* Directory is not encrypted */
                                        ext4fs_dirhash(de->name,
                                                de->name_len, &h);
                                               (unsigned) ((char *) de
                                                           - base));
                                } else {
+                                       struct fscrypt_str de_name =
+                                               FSTR_INIT(name, len);
                                        /* Directory is encrypted */
-                                       res = ext4_fname_crypto_alloc_buffer(
-                                               ctx, de->name_len,
+                                       res = fscrypt_fname_alloc_buffer(
+                                               dir, len,
                                                &fname_crypto_str);
-                                       if (res < 0) {
+                                       if (res < 0)
                                                printk(KERN_WARNING "Error "
                                                        "allocating crypto "
                                                        "buffer--skipping "
                                                        "crypto\n");
-                                               ctx = NULL;
-                                       }
-                                       res = ext4_fname_disk_to_usr(ctx, NULL, de,
-                                                       &fname_crypto_str);
+                                       res = fscrypt_fname_disk_to_usr(dir,
+                                               0, 0, &de_name,
+                                               &fname_crypto_str);
                                        if (res < 0) {
                                                printk(KERN_WARNING "Error "
                                                        "converting filename "
                                        printk("%*.s:(E)%x.%u ", len, name,
                                               h.hash, (unsigned) ((char *) de
                                                                   - base));
-                                       ext4_fname_crypto_free_buffer(
-                                               &fname_crypto_str);
+                                       fscrypt_fname_free_buffer(
+                                                       &fname_crypto_str);
                                }
  #else
                                int len = de->name_len;
@@@ -952,7 -953,7 +953,7 @@@ static int htree_dirblock_to_tree(struc
        struct buffer_head *bh;
        struct ext4_dir_entry_2 *de, *top;
        int err = 0, count = 0;
-       struct ext4_str fname_crypto_str = {.name = NULL, .len = 0}, tmp_str;
+       struct fscrypt_str fname_crypto_str = FSTR_INIT(NULL, 0), tmp_str;
  
        dxtrace(printk(KERN_INFO "In htree dirblock_to_tree: block %lu\n",
                                                        (unsigned long)block));
  #ifdef CONFIG_EXT4_FS_ENCRYPTION
        /* Check if the directory is encrypted */
        if (ext4_encrypted_inode(dir)) {
-               err = ext4_get_encryption_info(dir);
+               err = fscrypt_get_encryption_info(dir);
                if (err < 0) {
                        brelse(bh);
                        return err;
                }
-               err = ext4_fname_crypto_alloc_buffer(dir, EXT4_NAME_LEN,
+               err = fscrypt_fname_alloc_buffer(dir, EXT4_NAME_LEN,
                                                     &fname_crypto_str);
                if (err < 0) {
                        brelse(bh);
                                   &tmp_str);
                } else {
                        int save_len = fname_crypto_str.len;
+                       struct fscrypt_str de_name = FSTR_INIT(de->name,
+                                                               de->name_len);
  
                        /* Directory is encrypted */
-                       err = ext4_fname_disk_to_usr(dir, hinfo, de,
-                                                    &fname_crypto_str);
+                       err = fscrypt_fname_disk_to_usr(dir, hinfo->hash,
+                                       hinfo->minor_hash, &de_name,
+                                       &fname_crypto_str);
                        if (err < 0) {
                                count = err;
                                goto errout;
  errout:
        brelse(bh);
  #ifdef CONFIG_EXT4_FS_ENCRYPTION
-       ext4_fname_crypto_free_buffer(&fname_crypto_str);
+       fscrypt_fname_free_buffer(&fname_crypto_str);
  #endif
        return count;
  }
@@@ -1050,7 -1054,7 +1054,7 @@@ int ext4_htree_fill_tree(struct file *d
        int count = 0;
        int ret, err;
        __u32 hashval;
-       struct ext4_str tmp_str;
+       struct fscrypt_str tmp_str;
  
        dxtrace(printk(KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n",
                       start_hash, start_minor_hash));
@@@ -1443,8 -1447,7 +1447,8 @@@ restart
                                }
                                bh_use[ra_max] = bh;
                                if (bh)
 -                                      ll_rw_block(READ | REQ_META | REQ_PRIO,
 +                                      ll_rw_block(REQ_OP_READ,
 +                                                  REQ_META | REQ_PRIO,
                                                    1, &bh);
                        }
                }
@@@ -1564,26 -1567,23 +1568,23 @@@ static struct dentry *ext4_lookup(struc
        struct ext4_dir_entry_2 *de;
        struct buffer_head *bh;
  
-        if (ext4_encrypted_inode(dir)) {
-                int res = ext4_get_encryption_info(dir);
+       if (ext4_encrypted_inode(dir)) {
+               int res = fscrypt_get_encryption_info(dir);
  
                /*
-                * This should be a properly defined flag for
-                * dentry->d_flags when we uplift this to the VFS.
-                * d_fsdata is set to (void *) 1 if if the dentry is
+                * DCACHE_ENCRYPTED_WITH_KEY is set if the dentry is
                 * created while the directory was encrypted and we
-                * don't have access to the key.
+                * have access to the key.
                 */
-              dentry->d_fsdata = NULL;
-              if (ext4_encryption_info(dir))
-                      dentry->d_fsdata = (void *) 1;
-              d_set_d_op(dentry, &ext4_encrypted_d_ops);
-              if (res && res != -ENOKEY)
-                      return ERR_PTR(res);
-        }
+               if (fscrypt_has_encryption_key(dir))
+                       fscrypt_set_encrypted_dentry(dentry);
+               fscrypt_set_d_op(dentry);
+               if (res && res != -ENOKEY)
+                       return ERR_PTR(res);
+       }
  
-       if (dentry->d_name.len > EXT4_NAME_LEN)
-               return ERR_PTR(-ENAMETOOLONG);
+        if (dentry->d_name.len > EXT4_NAME_LEN)
+              return ERR_PTR(-ENAMETOOLONG);
  
        bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
        if (IS_ERR(bh))
                }
                if (!IS_ERR(inode) && ext4_encrypted_inode(dir) &&
                    (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) &&
-                   !ext4_is_child_context_consistent_with_parent(dir,
-                                                                 inode)) {
+                   !fscrypt_has_permitted_context(dir, inode)) {
                        int nokey = ext4_encrypted_inode(inode) &&
-                               !ext4_encryption_info(inode);
+                               !fscrypt_has_encryption_key(inode);
                        iput(inode);
                        if (nokey)
                                return ERR_PTR(-ENOKEY);
@@@ -2691,30 -2689,30 +2690,30 @@@ out_stop
  /*
   * routine to check that the specified directory is empty (for rmdir)
   */
int ext4_empty_dir(struct inode *inode)
bool ext4_empty_dir(struct inode *inode)
  {
        unsigned int offset;
        struct buffer_head *bh;
        struct ext4_dir_entry_2 *de, *de1;
        struct super_block *sb;
-       int err = 0;
  
        if (ext4_has_inline_data(inode)) {
                int has_inline_data = 1;
+               int ret;
  
-               err = empty_inline_dir(inode, &has_inline_data);
+               ret = empty_inline_dir(inode, &has_inline_data);
                if (has_inline_data)
-                       return err;
+                       return ret;
        }
  
        sb = inode->i_sb;
        if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)) {
                EXT4_ERROR_INODE(inode, "invalid size");
-               return 1;
+               return true;
        }
        bh = ext4_read_dirblock(inode, 0, EITHER);
        if (IS_ERR(bh))
-               return 1;
+               return true;
  
        de = (struct ext4_dir_entry_2 *) bh->b_data;
        de1 = ext4_next_entry(de, sb->s_blocksize);
                        strcmp(".", de->name) || strcmp("..", de1->name)) {
                ext4_warning_inode(inode, "directory missing '.' and/or '..'");
                brelse(bh);
-               return 1;
+               return true;
        }
        offset = ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize) +
                 ext4_rec_len_from_disk(de1->rec_len, sb->s_blocksize);
        while (offset < inode->i_size) {
                if ((void *) de >= (void *) (bh->b_data+sb->s_blocksize)) {
                        unsigned int lblock;
-                       err = 0;
                        brelse(bh);
                        lblock = offset >> EXT4_BLOCK_SIZE_BITS(sb);
                        bh = ext4_read_dirblock(inode, lblock, EITHER);
                        if (IS_ERR(bh))
-                               return 1;
+                               return true;
                        de = (struct ext4_dir_entry_2 *) bh->b_data;
                }
                if (ext4_check_dir_entry(inode, NULL, de, bh,
                }
                if (le32_to_cpu(de->inode)) {
                        brelse(bh);
-                       return 0;
+                       return false;
                }
                offset += ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize);
                de = ext4_next_entry(de, sb->s_blocksize);
        }
        brelse(bh);
-       return 1;
+       return true;
  }
  
  /*
@@@ -3077,8 -3074,8 +3075,8 @@@ static int ext4_symlink(struct inode *d
        int err, len = strlen(symname);
        int credits;
        bool encryption_required;
-       struct ext4_str disk_link;
-       struct ext4_encrypted_symlink_data *sd = NULL;
+       struct fscrypt_str disk_link;
+       struct fscrypt_symlink_data *sd = NULL;
  
        disk_link.len = len + 1;
        disk_link.name = (char *) symname;
        encryption_required = (ext4_encrypted_inode(dir) ||
                               DUMMY_ENCRYPTION_ENABLED(EXT4_SB(dir->i_sb)));
        if (encryption_required) {
-               err = ext4_get_encryption_info(dir);
+               err = fscrypt_get_encryption_info(dir);
                if (err)
                        return err;
-               if (ext4_encryption_info(dir) == NULL)
+               if (!fscrypt_has_encryption_key(dir))
                        return -EPERM;
-               disk_link.len = (ext4_fname_encrypted_size(dir, len) +
-                                sizeof(struct ext4_encrypted_symlink_data));
+               disk_link.len = (fscrypt_fname_encrypted_size(dir, len) +
+                                sizeof(struct fscrypt_symlink_data));
                sd = kzalloc(disk_link.len, GFP_KERNEL);
                if (!sd)
                        return -ENOMEM;
  
        if (encryption_required) {
                struct qstr istr;
-               struct ext4_str ostr;
+               struct fscrypt_str ostr =
+                       FSTR_INIT(sd->encrypted_path, disk_link.len);
  
                istr.name = (const unsigned char *) symname;
                istr.len = len;
-               ostr.name = sd->encrypted_path;
-               ostr.len = disk_link.len;
-               err = ext4_fname_usr_to_disk(inode, &istr, &ostr);
+               err = fscrypt_fname_usr_to_disk(inode, &istr, &ostr);
                if (err < 0)
                        goto err_drop_inode;
                sd->len = cpu_to_le16(ostr.len);
@@@ -3235,7 -3231,7 +3232,7 @@@ static int ext4_link(struct dentry *old
        if (inode->i_nlink >= EXT4_LINK_MAX)
                return -EMLINK;
        if (ext4_encrypted_inode(dir) &&
-           !ext4_is_child_context_consistent_with_parent(dir, inode))
+                       !fscrypt_has_permitted_context(dir, inode))
                return -EPERM;
  
         if ((ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT)) &&
@@@ -3558,8 -3554,7 +3555,7 @@@ static int ext4_rename(struct inode *ol
  
        if ((old.dir != new.dir) &&
            ext4_encrypted_inode(new.dir) &&
-           !ext4_is_child_context_consistent_with_parent(new.dir,
-                                                         old.inode)) {
+           !fscrypt_has_permitted_context(new.dir, old.inode)) {
                retval = -EPERM;
                goto end_rename;
        }
@@@ -3731,10 -3726,8 +3727,8 @@@ static int ext4_cross_rename(struct ino
        if ((ext4_encrypted_inode(old_dir) ||
             ext4_encrypted_inode(new_dir)) &&
            (old_dir != new_dir) &&
-           (!ext4_is_child_context_consistent_with_parent(new_dir,
-                                                          old.inode) ||
-            !ext4_is_child_context_consistent_with_parent(old_dir,
-                                                          new.inode)))
+           (!fscrypt_has_permitted_context(new_dir, old.inode) ||
+            !fscrypt_has_permitted_context(old_dir, new.inode)))
                return -EPERM;
  
        if ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT) &&
diff --combined fs/ext4/page-io.c
@@@ -24,6 -24,7 +24,7 @@@
  #include <linux/slab.h>
  #include <linux/mm.h>
  #include <linux/backing-dev.h>
+ #include <linux/fscrypto.h>
  
  #include "ext4_jbd2.h"
  #include "xattr.h"
@@@ -67,7 -68,6 +68,6 @@@ static void ext4_finish_bio(struct bio 
                struct page *page = bvec->bv_page;
  #ifdef CONFIG_EXT4_FS_ENCRYPTION
                struct page *data_page = NULL;
-               struct ext4_crypto_ctx *ctx = NULL;
  #endif
                struct buffer_head *bh, *head;
                unsigned bio_start = bvec->bv_offset;
@@@ -82,8 -82,7 +82,7 @@@
                if (!page->mapping) {
                        /* The bounce data pages are unmapped. */
                        data_page = page;
-                       ctx = (struct ext4_crypto_ctx *)page_private(data_page);
-                       page = ctx->w.control_page;
+                       fscrypt_pullback_bio_page(&page, false);
                }
  #endif
  
                local_irq_restore(flags);
                if (!under_io) {
  #ifdef CONFIG_EXT4_FS_ENCRYPTION
-                       if (ctx)
-                               ext4_restore_control_page(data_page);
+                       if (data_page)
+                               fscrypt_restore_control_page(data_page);
  #endif
                        end_page_writeback(page);
                }
@@@ -340,10 -339,9 +339,10 @@@ void ext4_io_submit(struct ext4_io_subm
        struct bio *bio = io->io_bio;
  
        if (bio) {
 -              int io_op = io->io_wbc->sync_mode == WB_SYNC_ALL ?
 -                          WRITE_SYNC : WRITE;
 -              submit_bio(io_op, io->io_bio);
 +              int io_op_flags = io->io_wbc->sync_mode == WB_SYNC_ALL ?
 +                                WRITE_SYNC : 0;
 +              bio_set_op_attrs(io->io_bio, REQ_OP_WRITE, io_op_flags);
 +              submit_bio(io->io_bio);
        }
        io->io_bio = NULL;
  }
@@@ -473,7 -471,7 +472,7 @@@ int ext4_bio_write_page(struct ext4_io_
                gfp_t gfp_flags = GFP_NOFS;
  
        retry_encrypt:
-               data_page = ext4_encrypt(inode, page, gfp_flags);
+               data_page = fscrypt_encrypt_page(inode, page, gfp_flags);
                if (IS_ERR(data_page)) {
                        ret = PTR_ERR(data_page);
                        if (ret == -ENOMEM && wbc->sync_mode == WB_SYNC_ALL) {
        if (ret) {
        out:
                if (data_page)
-                       ext4_restore_control_page(data_page);
+                       fscrypt_restore_control_page(data_page);
                printk_ratelimited(KERN_ERR "%s: ret = %d\n", __func__, ret);
                redirty_page_for_writepage(wbc, page);
                do {
diff --combined fs/ext4/readpage.c
  
  #include "ext4.h"
  
- /*
-  * Call ext4_decrypt on every single page, reusing the encryption
-  * context.
-  */
- static void completion_pages(struct work_struct *work)
- {
- #ifdef CONFIG_EXT4_FS_ENCRYPTION
-       struct ext4_crypto_ctx *ctx =
-               container_of(work, struct ext4_crypto_ctx, r.work);
-       struct bio      *bio    = ctx->r.bio;
-       struct bio_vec  *bv;
-       int             i;
-       bio_for_each_segment_all(bv, bio, i) {
-               struct page *page = bv->bv_page;
-               int ret = ext4_decrypt(page);
-               if (ret) {
-                       WARN_ON_ONCE(1);
-                       SetPageError(page);
-               } else
-                       SetPageUptodate(page);
-               unlock_page(page);
-       }
-       ext4_release_crypto_ctx(ctx);
-       bio_put(bio);
- #else
-       BUG();
- #endif
- }
  static inline bool ext4_bio_encrypted(struct bio *bio)
  {
  #ifdef CONFIG_EXT4_FS_ENCRYPTION
@@@ -104,14 -73,10 +73,10 @@@ static void mpage_end_io(struct bio *bi
        int i;
  
        if (ext4_bio_encrypted(bio)) {
-               struct ext4_crypto_ctx *ctx = bio->bi_private;
                if (bio->bi_error) {
-                       ext4_release_crypto_ctx(ctx);
+                       fscrypt_release_ctx(bio->bi_private);
                } else {
-                       INIT_WORK(&ctx->r.work, completion_pages);
-                       ctx->r.bio = bio;
-                       queue_work(ext4_read_workqueue, &ctx->r.work);
+                       fscrypt_decrypt_bio_pages(bio->bi_private, bio);
                        return;
                }
        }
@@@ -135,7 -100,6 +100,6 @@@ int ext4_mpage_readpages(struct address
                         unsigned nr_pages)
  {
        struct bio *bio = NULL;
-       unsigned page_idx;
        sector_t last_block_in_bio = 0;
  
        struct inode *inode = mapping->host;
        map.m_len = 0;
        map.m_flags = 0;
  
-       for (page_idx = 0; nr_pages; page_idx++, nr_pages--) {
+       for (; nr_pages; nr_pages--) {
                int fully_mapped = 1;
                unsigned first_hole = blocks_per_page;
  
                 */
                if (bio && (last_block_in_bio != blocks[0] - 1)) {
                submit_and_realloc:
 -                      submit_bio(READ, bio);
 +                      submit_bio(bio);
                        bio = NULL;
                }
                if (bio == NULL) {
-                       struct ext4_crypto_ctx *ctx = NULL;
+                       struct fscrypt_ctx *ctx = NULL;
  
                        if (ext4_encrypted_inode(inode) &&
                            S_ISREG(inode->i_mode)) {
-                               ctx = ext4_get_crypto_ctx(inode, GFP_NOFS);
+                               ctx = fscrypt_get_ctx(inode, GFP_NOFS);
                                if (IS_ERR(ctx))
                                        goto set_error_page;
                        }
                                min_t(int, nr_pages, BIO_MAX_PAGES));
                        if (!bio) {
                                if (ctx)
-                                       ext4_release_crypto_ctx(ctx);
+                                       fscrypt_release_ctx(ctx);
                                goto set_error_page;
                        }
                        bio->bi_bdev = bdev;
                        bio->bi_iter.bi_sector = blocks[0] << (blkbits - 9);
                        bio->bi_end_io = mpage_end_io;
                        bio->bi_private = ctx;
 +                      bio_set_op_attrs(bio, REQ_OP_READ, 0);
                }
  
                length = first_hole << blkbits;
                if (((map.m_flags & EXT4_MAP_BOUNDARY) &&
                     (relative_block == map.m_len)) ||
                    (first_hole != blocks_per_page)) {
 -                      submit_bio(READ, bio);
 +                      submit_bio(bio);
                        bio = NULL;
                } else
                        last_block_in_bio = blocks[blocks_per_page - 1];
                goto next_page;
        confused:
                if (bio) {
 -                      submit_bio(READ, bio);
 +                      submit_bio(bio);
                        bio = NULL;
                }
                if (!PageUptodate(page))
        }
        BUG_ON(pages && !list_empty(pages));
        if (bio)
 -              submit_bio(READ, bio);
 +              submit_bio(bio);
        return 0;
  }
diff --combined fs/ext4/super.c
@@@ -945,9 -945,6 +945,6 @@@ static struct inode *ext4_alloc_inode(s
        ei->i_datasync_tid = 0;
        atomic_set(&ei->i_unwritten, 0);
        INIT_WORK(&ei->i_rsv_conversion_work, ext4_end_io_rsv_work);
- #ifdef CONFIG_EXT4_FS_ENCRYPTION
-       ei->i_crypt_info = NULL;
- #endif
        return &ei->vfs_inode;
  }
  
@@@ -1026,8 -1023,7 +1023,7 @@@ void ext4_clear_inode(struct inode *ino
                EXT4_I(inode)->jinode = NULL;
        }
  #ifdef CONFIG_EXT4_FS_ENCRYPTION
-       if (EXT4_I(inode)->i_crypt_info)
-               ext4_free_encryption_info(inode, EXT4_I(inode)->i_crypt_info);
+       fscrypt_put_encryption_info(inode, NULL);
  #endif
  }
  
@@@ -1094,6 -1090,90 +1090,90 @@@ static int bdev_try_to_free_page(struc
        return try_to_free_buffers(page);
  }
  
+ #ifdef CONFIG_EXT4_FS_ENCRYPTION
+ static int ext4_get_context(struct inode *inode, void *ctx, size_t len)
+ {
+       return ext4_xattr_get(inode, EXT4_XATTR_INDEX_ENCRYPTION,
+                                EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, ctx, len);
+ }
+ static int ext4_key_prefix(struct inode *inode, u8 **key)
+ {
+       *key = EXT4_SB(inode->i_sb)->key_prefix;
+       return EXT4_SB(inode->i_sb)->key_prefix_size;
+ }
+ static int ext4_prepare_context(struct inode *inode)
+ {
+       return ext4_convert_inline_data(inode);
+ }
+ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,
+                                                       void *fs_data)
+ {
+       handle_t *handle;
+       int res, res2;
+       /* fs_data is null when internally used. */
+       if (fs_data) {
+               res  = ext4_xattr_set(inode, EXT4_XATTR_INDEX_ENCRYPTION,
+                               EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, ctx,
+                               len, 0);
+               if (!res) {
+                       ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT);
+                       ext4_clear_inode_state(inode,
+                                       EXT4_STATE_MAY_INLINE_DATA);
+               }
+               return res;
+       }
+       handle = ext4_journal_start(inode, EXT4_HT_MISC,
+                       ext4_jbd2_credits_xattr(inode));
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+       res = ext4_xattr_set(inode, EXT4_XATTR_INDEX_ENCRYPTION,
+                       EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, ctx,
+                       len, 0);
+       if (!res) {
+               ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT);
+               res = ext4_mark_inode_dirty(handle, inode);
+               if (res)
+                       EXT4_ERROR_INODE(inode, "Failed to mark inode dirty");
+       }
+       res2 = ext4_journal_stop(handle);
+       if (!res)
+               res = res2;
+       return res;
+ }
+ static int ext4_dummy_context(struct inode *inode)
+ {
+       return DUMMY_ENCRYPTION_ENABLED(EXT4_SB(inode->i_sb));
+ }
+ static unsigned ext4_max_namelen(struct inode *inode)
+ {
+       return S_ISLNK(inode->i_mode) ? inode->i_sb->s_blocksize :
+               EXT4_NAME_LEN;
+ }
+ static struct fscrypt_operations ext4_cryptops = {
+       .get_context            = ext4_get_context,
+       .key_prefix             = ext4_key_prefix,
+       .prepare_context        = ext4_prepare_context,
+       .set_context            = ext4_set_context,
+       .dummy_context          = ext4_dummy_context,
+       .is_encrypted           = ext4_encrypted_inode,
+       .empty_dir              = ext4_empty_dir,
+       .max_namelen            = ext4_max_namelen,
+ };
+ #else
+ static struct fscrypt_operations ext4_cryptops = {
+       .is_encrypted           = ext4_encrypted_inode,
+ };
+ #endif
  #ifdef CONFIG_QUOTA
  static char *quotatypes[] = INITQFNAMES;
  #define QTYPE2NAME(t) (quotatypes[t])
@@@ -2068,23 -2148,25 +2148,25 @@@ failed
  static __le16 ext4_group_desc_csum(struct super_block *sb, __u32 block_group,
                                   struct ext4_group_desc *gdp)
  {
-       int offset;
+       int offset = offsetof(struct ext4_group_desc, bg_checksum);
        __u16 crc = 0;
        __le32 le_group = cpu_to_le32(block_group);
        struct ext4_sb_info *sbi = EXT4_SB(sb);
  
        if (ext4_has_metadata_csum(sbi->s_sb)) {
                /* Use new metadata_csum algorithm */
-               __le16 save_csum;
                __u32 csum32;
+               __u16 dummy_csum = 0;
  
-               save_csum = gdp->bg_checksum;
-               gdp->bg_checksum = 0;
                csum32 = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)&le_group,
                                     sizeof(le_group));
-               csum32 = ext4_chksum(sbi, csum32, (__u8 *)gdp,
-                                    sbi->s_desc_size);
-               gdp->bg_checksum = save_csum;
+               csum32 = ext4_chksum(sbi, csum32, (__u8 *)gdp, offset);
+               csum32 = ext4_chksum(sbi, csum32, (__u8 *)&dummy_csum,
+                                    sizeof(dummy_csum));
+               offset += sizeof(dummy_csum);
+               if (offset < sbi->s_desc_size)
+                       csum32 = ext4_chksum(sbi, csum32, (__u8 *)gdp + offset,
+                                            sbi->s_desc_size - offset);
  
                crc = csum32 & 0xFFFF;
                goto out;
        if (!ext4_has_feature_gdt_csum(sb))
                return 0;
  
-       offset = offsetof(struct ext4_group_desc, bg_checksum);
        crc = crc16(~0, sbi->s_es->s_uuid, sizeof(sbi->s_es->s_uuid));
        crc = crc16(crc, (__u8 *)&le_group, sizeof(le_group));
        crc = crc16(crc, (__u8 *)gdp, offset);
@@@ -2278,6 -2358,16 +2358,16 @@@ static void ext4_orphan_cleanup(struct 
        while (es->s_last_orphan) {
                struct inode *inode;
  
+               /*
+                * We may have encountered an error during cleanup; if
+                * so, skip the rest.
+                */
+               if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
+                       jbd_debug(1, "Skipping orphan recovery on fs with errors.\n");
+                       es->s_last_orphan = 0;
+                       break;
+               }
                inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan));
                if (IS_ERR(inode)) {
                        es->s_last_orphan = 0;
@@@ -3416,6 -3506,13 +3506,13 @@@ static int ext4_fill_super(struct super
                goto failed_mount;
        }
  
+       if (le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) > (blocksize / 4)) {
+               ext4_msg(sb, KERN_ERR,
+                        "Number of reserved GDT blocks insanely large: %d",
+                        le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks));
+               goto failed_mount;
+       }
        if (sbi->s_mount_opt & EXT4_MOUNT_DAX) {
                err = bdev_dax_supported(sb, blocksize);
                if (err)
        sb->s_op = &ext4_sops;
        sb->s_export_op = &ext4_export_ops;
        sb->s_xattr = ext4_xattr_handlers;
+       sb->s_cop = &ext4_cryptops;
  #ifdef CONFIG_QUOTA
        sb->dq_op = &ext4_quota_operations;
        if (ext4_has_feature_quota(sb))
@@@ -3996,6 -4094,11 +4094,11 @@@ no_journal
        ratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10);
  
        kfree(orig_data);
+ #ifdef CONFIG_EXT4_FS_ENCRYPTION
+       memcpy(sbi->key_prefix, EXT4_KEY_DESC_PREFIX,
+                               EXT4_KEY_DESC_PREFIX_SIZE);
+       sbi->key_prefix_size = EXT4_KEY_DESC_PREFIX_SIZE;
+ #endif
        return 0;
  
  cantfind_ext4:
@@@ -4204,7 -4307,7 +4307,7 @@@ static journal_t *ext4_get_dev_journal(
                goto out_bdev;
        }
        journal->j_private = sb;
 -      ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &journal->j_sb_buffer);
 +      ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &journal->j_sb_buffer);
        wait_on_buffer(journal->j_sb_buffer);
        if (!buffer_uptodate(journal->j_sb_buffer)) {
                ext4_msg(sb, KERN_ERR, "I/O error on journal device");
@@@ -4327,20 -4430,6 +4430,6 @@@ static int ext4_commit_super(struct sup
  
        if (!sbh || block_device_ejected(sb))
                return error;
-       if (buffer_write_io_error(sbh)) {
-               /*
-                * Oh, dear.  A previous attempt to write the
-                * superblock failed.  This could happen because the
-                * USB device was yanked out.  Or it could happen to
-                * be a transient write error and maybe the block will
-                * be remapped.  Nothing we can do but to retry the
-                * write and hope for the best.
-                */
-               ext4_msg(sb, KERN_ERR, "previous I/O error to "
-                      "superblock detected");
-               clear_buffer_write_io_error(sbh);
-               set_buffer_uptodate(sbh);
-       }
        /*
         * If the file system is mounted read-only, don't update the
         * superblock write time.  This avoids updating the superblock
                                &EXT4_SB(sb)->s_freeinodes_counter));
        BUFFER_TRACE(sbh, "marking dirty");
        ext4_superblock_csum_set(sb);
+       lock_buffer(sbh);
+       if (buffer_write_io_error(sbh)) {
+               /*
+                * Oh, dear.  A previous attempt to write the
+                * superblock failed.  This could happen because the
+                * USB device was yanked out.  Or it could happen to
+                * be a transient write error and maybe the block will
+                * be remapped.  Nothing we can do but to retry the
+                * write and hope for the best.
+                */
+               ext4_msg(sb, KERN_ERR, "previous I/O error to "
+                      "superblock detected");
+               clear_buffer_write_io_error(sbh);
+               set_buffer_uptodate(sbh);
+       }
        mark_buffer_dirty(sbh);
+       unlock_buffer(sbh);
        if (sync) {
                error = __sync_dirty_buffer(sbh,
                        test_opt(sb, BARRIER) ? WRITE_FUA : WRITE_SYNC);
@@@ -5422,7 -5527,6 +5527,6 @@@ out5
  
  static void __exit ext4_exit_fs(void)
  {
-       ext4_exit_crypto();
        ext4_destroy_lazyinit_thread();
        unregister_as_ext2();
        unregister_as_ext3();
diff --combined fs/jbd2/commit.c
@@@ -124,7 -124,7 +124,7 @@@ static int journal_submit_commit_record
        struct commit_header *tmp;
        struct buffer_head *bh;
        int ret;
-       struct timespec now = current_kernel_time();
+       struct timespec64 now = current_kernel_time64();
  
        *cbh = NULL;
  
  
        if (journal->j_flags & JBD2_BARRIER &&
            !jbd2_has_feature_async_commit(journal))
 -              ret = submit_bh(WRITE_SYNC | WRITE_FLUSH_FUA, bh);
 +              ret = submit_bh(REQ_OP_WRITE, WRITE_SYNC | WRITE_FLUSH_FUA, bh);
        else
 -              ret = submit_bh(WRITE_SYNC, bh);
 +              ret = submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh);
  
        *cbh = bh;
        return ret;
@@@ -718,7 -718,7 +718,7 @@@ start_journal_io
                                clear_buffer_dirty(bh);
                                set_buffer_uptodate(bh);
                                bh->b_end_io = journal_end_buffer_io_sync;
 -                              submit_bh(WRITE_SYNC, bh);
 +                              submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh);
                        }
                        cond_resched();
                        stats.run.rs_blocks_logged += bufs;
diff --combined fs/jbd2/journal.c
@@@ -691,6 -691,7 +691,7 @@@ int jbd2_log_wait_commit(journal_t *jou
  {
        int err = 0;
  
+       jbd2_might_wait_for_commit(journal);
        read_lock(&journal->j_state_lock);
  #ifdef CONFIG_JBD2_DEBUG
        if (!tid_geq(journal->j_commit_request, tid)) {
@@@ -1091,6 -1092,7 +1092,7 @@@ static void jbd2_stats_proc_exit(journa
  
  static journal_t * journal_init_common (void)
  {
+       static struct lock_class_key jbd2_trans_commit_key;
        journal_t *journal;
        int err;
  
  
        spin_lock_init(&journal->j_history_lock);
  
+       lockdep_init_map(&journal->j_trans_commit_map, "jbd2_handle",
+                        &jbd2_trans_commit_key, 0);
        return journal;
  }
  
@@@ -1346,15 -1351,15 +1351,15 @@@ static int journal_reset(journal_t *jou
        return jbd2_journal_start_thread(journal);
  }
  
 -static int jbd2_write_superblock(journal_t *journal, int write_op)
 +static int jbd2_write_superblock(journal_t *journal, int write_flags)
  {
        struct buffer_head *bh = journal->j_sb_buffer;
        journal_superblock_t *sb = journal->j_superblock;
        int ret;
  
 -      trace_jbd2_write_superblock(journal, write_op);
 +      trace_jbd2_write_superblock(journal, write_flags);
        if (!(journal->j_flags & JBD2_BARRIER))
 -              write_op &= ~(REQ_FUA | REQ_FLUSH);
 +              write_flags &= ~(REQ_FUA | REQ_PREFLUSH);
        lock_buffer(bh);
        if (buffer_write_io_error(bh)) {
                /*
        jbd2_superblock_csum_set(journal, sb);
        get_bh(bh);
        bh->b_end_io = end_buffer_write_sync;
 -      ret = submit_bh(write_op, bh);
 +      ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
        wait_on_buffer(bh);
        if (buffer_write_io_error(bh)) {
                clear_buffer_write_io_error(bh);
@@@ -1498,7 -1503,7 +1503,7 @@@ static int journal_get_superblock(journ
  
        J_ASSERT(bh != NULL);
        if (!buffer_uptodate(bh)) {
 -              ll_rw_block(READ, 1, &bh);
 +              ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                wait_on_buffer(bh);
                if (!buffer_uptodate(bh)) {
                        printk(KERN_ERR
@@@ -2329,10 -2334,18 +2334,10 @@@ void *jbd2_alloc(size_t size, gfp_t fla
  
        BUG_ON(size & (size-1)); /* Must be a power of 2 */
  
 -      flags |= __GFP_REPEAT;
 -      if (size == PAGE_SIZE)
 -              ptr = (void *)__get_free_pages(flags, 0);
 -      else if (size > PAGE_SIZE) {
 -              int order = get_order(size);
 -
 -              if (order < 3)
 -                      ptr = (void *)__get_free_pages(flags, order);
 -              else
 -                      ptr = vmalloc(size);
 -      } else
 +      if (size < PAGE_SIZE)
                ptr = kmem_cache_alloc(get_slab(size), flags);
 +      else
 +              ptr = (void *)__get_free_pages(flags, get_order(size));
  
        /* Check alignment; SLUB has gotten this wrong in the past,
         * and this can lead to user data corruption! */
  
  void jbd2_free(void *ptr, size_t size)
  {
 -      if (size == PAGE_SIZE) {
 -              free_pages((unsigned long)ptr, 0);
 -              return;
 -      }
 -      if (size > PAGE_SIZE) {
 -              int order = get_order(size);
 -
 -              if (order < 3)
 -                      free_pages((unsigned long)ptr, order);
 -              else
 -                      vfree(ptr);
 -              return;
 -      }
 -      kmem_cache_free(get_slab(size), ptr);
 +      if (size < PAGE_SIZE)
 +              kmem_cache_free(get_slab(size), ptr);
 +      else
 +              free_pages((unsigned long)ptr, get_order(size));
  };
  
  /*