--- /dev/null
+From 34511dce4b35685d3988d5c8b100d11a068db5bd Mon Sep 17 00:00:00 2001
+From: Mika Kahola <mika.kahola@intel.com>
+Date: Mon, 20 Jun 2016 11:10:26 +0300
+Subject: drm/i915: Revert DisplayPort fast link training feature
+
+From: Mika Kahola <mika.kahola@intel.com>
+
+commit 34511dce4b35685d3988d5c8b100d11a068db5bd upstream.
+
+It has been found out that in some HW combination the DisplayPort
+fast link training feature caused screen flickering. Let's revert
+this feature for now until we can ensure that the feature works for
+all platforms.
+
+This is a manual revert of commits 5fa836a9d859 ("drm/i915: DP link
+training optimization") and 4e96c97742f4 ("drm/i915: eDP link training
+optimization").
+
+Fixes: 5fa836a9d859 ("drm/i915: DP link training optimization")
+Fixes: 4e96c97742f4 ("drm/i915: eDP link training optimization")
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91393
+Reviewed-by: Jani Nikula <jani.nikula@intel.com>
+Signed-off-by: Mika Kahola <mika.kahola@intel.com>
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Link: http://patchwork.freedesktop.org/patch/msgid/1466410226-19543-1-git-send-email-mika.kahola@intel.com
+(cherry picked from commit 91df09d92ad82c8778ca218097bf827f154292ca)
+Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_dp.c | 28 ++--------------------------
+ drivers/gpu/drm/i915/intel_drv.h | 1 -
+ 2 files changed, 2 insertions(+), 27 deletions(-)
+
+--- a/drivers/gpu/drm/i915/intel_dp.c
++++ b/drivers/gpu/drm/i915/intel_dp.c
+@@ -3628,8 +3628,7 @@ static bool
+ intel_dp_reset_link_train(struct intel_dp *intel_dp, uint32_t *DP,
+ uint8_t dp_train_pat)
+ {
+- if (!intel_dp->train_set_valid)
+- memset(intel_dp->train_set, 0, sizeof(intel_dp->train_set));
++ memset(intel_dp->train_set, 0, sizeof(intel_dp->train_set));
+ intel_dp_set_signal_levels(intel_dp, DP);
+ return intel_dp_set_link_train(intel_dp, DP, dp_train_pat);
+ }
+@@ -3746,22 +3745,6 @@ intel_dp_link_training_clock_recovery(st
+ break;
+ }
+
+- /*
+- * if we used previously trained voltage and pre-emphasis values
+- * and we don't get clock recovery, reset link training values
+- */
+- if (intel_dp->train_set_valid) {
+- DRM_DEBUG_KMS("clock recovery not ok, reset");
+- /* clear the flag as we are not reusing train set */
+- intel_dp->train_set_valid = false;
+- if (!intel_dp_reset_link_train(intel_dp, &DP,
+- DP_TRAINING_PATTERN_1 |
+- DP_LINK_SCRAMBLING_DISABLE)) {
+- DRM_ERROR("failed to enable link training\n");
+- return;
+- }
+- continue;
+- }
+
+ /* Check to see if we've tried the max voltage */
+ for (i = 0; i < intel_dp->lane_count; i++)
+@@ -3854,7 +3837,6 @@ intel_dp_link_training_channel_equalizat
+ /* Make sure clock is still ok */
+ if (!drm_dp_clock_recovery_ok(link_status,
+ intel_dp->lane_count)) {
+- intel_dp->train_set_valid = false;
+ intel_dp_link_training_clock_recovery(intel_dp);
+ intel_dp_set_link_train(intel_dp, &DP,
+ training_pattern |
+@@ -3871,7 +3853,6 @@ intel_dp_link_training_channel_equalizat
+
+ /* Try 5 times, then try clock recovery if that fails */
+ if (tries > 5) {
+- intel_dp->train_set_valid = false;
+ intel_dp_link_training_clock_recovery(intel_dp);
+ intel_dp_set_link_train(intel_dp, &DP,
+ training_pattern |
+@@ -3893,10 +3874,8 @@ intel_dp_link_training_channel_equalizat
+
+ intel_dp->DP = DP;
+
+- if (channel_eq) {
+- intel_dp->train_set_valid = true;
++ if (channel_eq)
+ DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n");
+- }
+ }
+
+ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
+@@ -5159,9 +5138,6 @@ intel_dp_hpd_pulse(struct intel_digital_
+ intel_display_power_get(dev_priv, power_domain);
+
+ if (long_hpd) {
+- /* indicate that we need to restart link training */
+- intel_dp->train_set_valid = false;
+-
+ if (!intel_digital_port_connected(dev_priv, intel_dig_port))
+ goto mst_fail;
+
+--- a/drivers/gpu/drm/i915/intel_drv.h
++++ b/drivers/gpu/drm/i915/intel_drv.h
+@@ -783,7 +783,6 @@ struct intel_dp {
+ bool has_aux_irq,
+ int send_bytes,
+ uint32_t aux_clock_divider);
+- bool train_set_valid;
+
+ /* Displayport compliance testing */
+ unsigned long compliance_test_type;
--- /dev/null
+From 11f3710417d026ea2f4fcf362d866342c5274185 Mon Sep 17 00:00:00 2001
+From: Miklos Szeredi <mszeredi@redhat.com>
+Date: Mon, 21 Mar 2016 17:31:44 +0100
+Subject: ovl: verify upper dentry before unlink and rename
+
+From: Miklos Szeredi <mszeredi@redhat.com>
+
+commit 11f3710417d026ea2f4fcf362d866342c5274185 upstream.
+
+Unlink and rename in overlayfs checked the upper dentry for staleness by
+verifying upper->d_parent against upperdir. However the dentry can go
+stale also by being unhashed, for example.
+
+Expand the verification to actually look up the name again (under parent
+lock) and check if it matches the upper dentry. This matches what the VFS
+does before passing the dentry to filesytem's unlink/rename methods, which
+excludes any inconsistency caused by overlayfs.
+
+Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/overlayfs/dir.c | 59 ++++++++++++++++++++++++++++++++++-------------------
+ 1 file changed, 38 insertions(+), 21 deletions(-)
+
+--- a/fs/overlayfs/dir.c
++++ b/fs/overlayfs/dir.c
+@@ -590,21 +590,25 @@ static int ovl_remove_upper(struct dentr
+ {
+ struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
+ struct inode *dir = upperdir->d_inode;
+- struct dentry *upper = ovl_dentry_upper(dentry);
++ struct dentry *upper;
+ int err;
+
+ mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
++ upper = lookup_one_len(dentry->d_name.name, upperdir,
++ dentry->d_name.len);
++ err = PTR_ERR(upper);
++ if (IS_ERR(upper))
++ goto out_unlock;
++
+ err = -ESTALE;
+- if (upper->d_parent == upperdir) {
+- /* Don't let d_delete() think it can reset d_inode */
+- dget(upper);
++ if (upper == ovl_dentry_upper(dentry)) {
+ if (is_dir)
+ err = vfs_rmdir(dir, upper);
+ else
+ err = vfs_unlink(dir, upper, NULL);
+- dput(upper);
+ ovl_dentry_version_inc(dentry->d_parent);
+ }
++ dput(upper);
+
+ /*
+ * Keeping this dentry hashed would mean having to release
+@@ -614,6 +618,7 @@ static int ovl_remove_upper(struct dentr
+ */
+ if (!err)
+ d_drop(dentry);
++out_unlock:
+ mutex_unlock(&dir->i_mutex);
+
+ return err;
+@@ -834,29 +839,39 @@ static int ovl_rename2(struct inode *old
+
+ trap = lock_rename(new_upperdir, old_upperdir);
+
+- olddentry = ovl_dentry_upper(old);
+- newdentry = ovl_dentry_upper(new);
+- if (newdentry) {
++
++ olddentry = lookup_one_len(old->d_name.name, old_upperdir,
++ old->d_name.len);
++ err = PTR_ERR(olddentry);
++ if (IS_ERR(olddentry))
++ goto out_unlock;
++
++ err = -ESTALE;
++ if (olddentry != ovl_dentry_upper(old))
++ goto out_dput_old;
++
++ newdentry = lookup_one_len(new->d_name.name, new_upperdir,
++ new->d_name.len);
++ err = PTR_ERR(newdentry);
++ if (IS_ERR(newdentry))
++ goto out_dput_old;
++
++ err = -ESTALE;
++ if (ovl_dentry_upper(new)) {
+ if (opaquedir) {
+- newdentry = opaquedir;
+- opaquedir = NULL;
++ if (newdentry != opaquedir)
++ goto out_dput;
+ } else {
+- dget(newdentry);
++ if (newdentry != ovl_dentry_upper(new))
++ goto out_dput;
+ }
+ } else {
+ new_create = true;
+- newdentry = lookup_one_len(new->d_name.name, new_upperdir,
+- new->d_name.len);
+- err = PTR_ERR(newdentry);
+- if (IS_ERR(newdentry))
+- goto out_unlock;
++ if (!d_is_negative(newdentry) &&
++ (!new_opaque || !ovl_is_whiteout(newdentry)))
++ goto out_dput;
+ }
+
+- err = -ESTALE;
+- if (olddentry->d_parent != old_upperdir)
+- goto out_dput;
+- if (newdentry->d_parent != new_upperdir)
+- goto out_dput;
+ if (olddentry == trap)
+ goto out_dput;
+ if (newdentry == trap)
+@@ -919,6 +934,8 @@ static int ovl_rename2(struct inode *old
+
+ out_dput:
+ dput(newdentry);
++out_dput_old:
++ dput(olddentry);
+ out_unlock:
+ unlock_rename(new_upperdir, old_upperdir);
+ out_revert_creds:
file-names-with-trailing-period-or-space-need-special-case-conversion.patch
xen-acpi-allow-xen-acpi-processor-driver-to-load-on-xen-4.7.patch
crypto-qat-make-qat_asym_algs.o-depend-on-asn1-headers.patch
+tmpfs-don-t-undo-fallocate-past-its-last-page.patch
+tmpfs-fix-regression-hang-in-fallocate-undo.patch
+drm-i915-revert-displayport-fast-link-training-feature.patch
+ovl-verify-upper-dentry-before-unlink-and-rename.patch
--- /dev/null
+From b9b4bb26af017dbe930cd4df7f9b2fc3a0497bfe Mon Sep 17 00:00:00 2001
+From: Anthony Romano <anthony.romano@coreos.com>
+Date: Fri, 24 Jun 2016 14:48:43 -0700
+Subject: tmpfs: don't undo fallocate past its last page
+
+From: Anthony Romano <anthony.romano@coreos.com>
+
+commit b9b4bb26af017dbe930cd4df7f9b2fc3a0497bfe upstream.
+
+When fallocate is interrupted it will undo a range that extends one byte
+past its range of allocated pages. This can corrupt an in-use page by
+zeroing out its first byte. Instead, undo using the inclusive byte
+range.
+
+Fixes: 1635f6a74152f1d ("tmpfs: undo fallocation on failure")
+Link: http://lkml.kernel.org/r/1462713387-16724-1-git-send-email-anthony.romano@coreos.com
+Signed-off-by: Anthony Romano <anthony.romano@coreos.com>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: Hugh Dickins <hughd@google.com>
+Cc: Brandon Philips <brandon@ifup.co>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/shmem.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/mm/shmem.c
++++ b/mm/shmem.c
+@@ -2155,7 +2155,7 @@ static long shmem_fallocate(struct file
+ /* Remove the !PageUptodate pages we added */
+ shmem_undo_range(inode,
+ (loff_t)start << PAGE_CACHE_SHIFT,
+- (loff_t)index << PAGE_CACHE_SHIFT, true);
++ ((loff_t)index << PAGE_CACHE_SHIFT) - 1, true);
+ goto undone;
+ }
+
--- /dev/null
+From 7f556567036cb7f89aabe2f0954b08566b4efb53 Mon Sep 17 00:00:00 2001
+From: Hugh Dickins <hughd@google.com>
+Date: Sun, 10 Jul 2016 16:46:32 -0700
+Subject: tmpfs: fix regression hang in fallocate undo
+
+From: Hugh Dickins <hughd@google.com>
+
+commit 7f556567036cb7f89aabe2f0954b08566b4efb53 upstream.
+
+The well-spotted fallocate undo fix is good in most cases, but not when
+fallocate failed on the very first page. index 0 then passes lend -1
+to shmem_undo_range(), and that has two bad effects: (a) that it will
+undo every fallocation throughout the file, unrestricted by the current
+range; but more importantly (b) it can cause the undo to hang, because
+lend -1 is treated as truncation, which makes it keep on retrying until
+every page has gone, but those already fully instantiated will never go
+away. Big thank you to xfstests generic/269 which demonstrates this.
+
+Fixes: b9b4bb26af01 ("tmpfs: don't undo fallocate past its last page")
+Signed-off-by: Hugh Dickins <hughd@google.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/shmem.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/mm/shmem.c
++++ b/mm/shmem.c
+@@ -2153,9 +2153,11 @@ static long shmem_fallocate(struct file
+ NULL);
+ if (error) {
+ /* Remove the !PageUptodate pages we added */
+- shmem_undo_range(inode,
+- (loff_t)start << PAGE_CACHE_SHIFT,
+- ((loff_t)index << PAGE_CACHE_SHIFT) - 1, true);
++ if (index > start) {
++ shmem_undo_range(inode,
++ (loff_t)start << PAGE_CACHE_SHIFT,
++ ((loff_t)index << PAGE_CACHE_SHIFT) - 1, true);
++ }
+ goto undone;
+ }
+