From: Greg Kroah-Hartman Date: Mon, 24 Feb 2014 23:12:52 +0000 (-0800) Subject: 3.13-stable patches X-Git-Tag: v3.10.33~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=659814e2e0c06347fd5505463d7f92ffdd0a9054;p=thirdparty%2Fkernel%2Fstable-queue.git 3.13-stable patches added patches: drm-i915-add-intel_ring_cachline_align.patch drm-i915-prevent-mi_display_flip-straddling-two-cachelines-on-ivb.patch drm-nouveau-fb-use-correct-ram-oclass-for-nv1a-hardware.patch drm-nouveau-set-irq_enabled-manually.patch drm-nv50-disp-use-correct-register-to-determine-dp-display-bpp.patch drm-radeon-fix-cp-semaphores-on-cik.patch drm-radeon-fix-display-tiling-setup-on-si.patch drm-radeon-ni-fix-typo-in-dpm-sq-ramping-setup.patch ext4-don-t-leave-i_crtime.tv_sec-uninitialized.patch ext4-don-t-try-to-modify-s_flags-if-the-the-file-system-is-read-only.patch ext4-fix-error-paths-in-swap_inode_boot_loader.patch ext4-fix-online-resize-with-a-non-standard-blocks-per-group-setting.patch ext4-fix-online-resize-with-very-large-inode-tables.patch ext4-fix-xfstest-generic-299-block-validity-failures.patch --- diff --git a/queue-3.13/drm-i915-add-intel_ring_cachline_align.patch b/queue-3.13/drm-i915-add-intel_ring_cachline_align.patch new file mode 100644 index 00000000000..6b6a133cc06 --- /dev/null +++ b/queue-3.13/drm-i915-add-intel_ring_cachline_align.patch @@ -0,0 +1,69 @@ +From 753b1ad4a281b0663329409d410243e91825c323 Mon Sep 17 00:00:00 2001 +From: Ville Syrjälä +Date: Tue, 11 Feb 2014 19:52:05 +0200 +Subject: drm/i915: Add intel_ring_cachline_align() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +commit 753b1ad4a281b0663329409d410243e91825c323 upstream. + +intel_ring_cachline_align() emits MI_NOOPs until the ring tail is +aligned to a cacheline boundary. + +Cc: Bjoern C +Cc: Alexandru DAMIAN +Cc: Enrico Tagliavini +Suggested-by: Chris Wilson +Signed-off-by: Ville Syrjälä +Reviewed-by: Chris Wilson +Signed-off-by: Daniel Vetter +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_ringbuffer.c | 21 +++++++++++++++++++++ + drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + + 2 files changed, 22 insertions(+) + +--- a/drivers/gpu/drm/i915/intel_ringbuffer.c ++++ b/drivers/gpu/drm/i915/intel_ringbuffer.c +@@ -1655,6 +1655,27 @@ int intel_ring_begin(struct intel_ring_b + return 0; + } + ++/* Align the ring tail to a cacheline boundary */ ++int intel_ring_cacheline_align(struct intel_ring_buffer *ring) ++{ ++ int num_dwords = (64 - (ring->tail & 63)) / sizeof(uint32_t); ++ int ret; ++ ++ if (num_dwords == 0) ++ return 0; ++ ++ ret = intel_ring_begin(ring, num_dwords); ++ if (ret) ++ return ret; ++ ++ while (num_dwords--) ++ intel_ring_emit(ring, MI_NOOP); ++ ++ intel_ring_advance(ring); ++ ++ return 0; ++} ++ + void intel_ring_init_seqno(struct intel_ring_buffer *ring, u32 seqno) + { + struct drm_i915_private *dev_priv = ring->dev->dev_private; +--- a/drivers/gpu/drm/i915/intel_ringbuffer.h ++++ b/drivers/gpu/drm/i915/intel_ringbuffer.h +@@ -233,6 +233,7 @@ intel_write_status_page(struct intel_rin + void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring); + + int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n); ++int __must_check intel_ring_cacheline_align(struct intel_ring_buffer *ring); + static inline void intel_ring_emit(struct intel_ring_buffer *ring, + u32 data) + { diff --git a/queue-3.13/drm-i915-prevent-mi_display_flip-straddling-two-cachelines-on-ivb.patch b/queue-3.13/drm-i915-prevent-mi_display_flip-straddling-two-cachelines-on-ivb.patch new file mode 100644 index 00000000000..68fb6e15874 --- /dev/null +++ b/queue-3.13/drm-i915-prevent-mi_display_flip-straddling-two-cachelines-on-ivb.patch @@ -0,0 +1,54 @@ +From f66fab8e1cd6b3127ba4c5c0d11539fbe1de1e36 Mon Sep 17 00:00:00 2001 +From: Ville Syrjälä +Date: Tue, 11 Feb 2014 19:52:06 +0200 +Subject: drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +commit f66fab8e1cd6b3127ba4c5c0d11539fbe1de1e36 upstream. + +According to BSpec the entire MI_DISPLAY_FLIP packet must be contained +in a single cacheline. Make sure that happens. + +v2: Use intel_ring_begin_cacheline_safe() +v3: Use intel_ring_cacheline_align() (Chris) + +Cc: Bjoern C +Cc: Alexandru DAMIAN +Cc: Enrico Tagliavini +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74053 +Signed-off-by: Ville Syrjälä +Cc: stable@vger.kernel.org +Signed-off-by: Daniel Vetter +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_display.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/gpu/drm/i915/intel_display.c ++++ b/drivers/gpu/drm/i915/intel_display.c +@@ -8335,6 +8335,20 @@ static int intel_gen7_queue_flip(struct + if (ring->id == RCS) + len += 6; + ++ /* ++ * BSpec MI_DISPLAY_FLIP for IVB: ++ * "The full packet must be contained within the same cache line." ++ * ++ * Currently the LRI+SRM+MI_DISPLAY_FLIP all fit within the same ++ * cacheline, if we ever start emitting more commands before ++ * the MI_DISPLAY_FLIP we may need to first emit everything else, ++ * then do the cacheline alignment, and finally emit the ++ * MI_DISPLAY_FLIP. ++ */ ++ ret = intel_ring_cacheline_align(ring); ++ if (ret) ++ goto err_unpin; ++ + ret = intel_ring_begin(ring, len); + if (ret) + goto err_unpin; diff --git a/queue-3.13/drm-nouveau-fb-use-correct-ram-oclass-for-nv1a-hardware.patch b/queue-3.13/drm-nouveau-fb-use-correct-ram-oclass-for-nv1a-hardware.patch new file mode 100644 index 00000000000..6efc320c67a --- /dev/null +++ b/queue-3.13/drm-nouveau-fb-use-correct-ram-oclass-for-nv1a-hardware.patch @@ -0,0 +1,39 @@ +From 95ca5b550ac255bf3cee108c123407785c47e3cc Mon Sep 17 00:00:00 2001 +From: Emil Velikov +Date: Wed, 12 Feb 2014 01:41:42 +0000 +Subject: drm/nouveau/fb: use correct ram oclass for nv1a hardware + +From: Emil Velikov + +commit 95ca5b550ac255bf3cee108c123407785c47e3cc upstream. + +commit 8613e7314ac254fdd67ed46192f021d76141e4c9 +Author: Ben Skeggs +Date: Mon Oct 21 08:50:25 2013 +1000 + + drm/nouveau/fb: remove ram oclass argument from base fb constructor + +Introduced a unfortunate regression by using nv10 ram oclass for nv1a +hardware, causing corruption and eventually system lockup. + +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74866 +Reported-by: John F. Godfrey +Signed-off-by: Emil Velikov +Signed-off-by: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c ++++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c +@@ -36,7 +36,7 @@ nv1a_fb_oclass = &(struct nv04_fb_impl) + .fini = _nouveau_fb_fini, + }, + .base.memtype = nv04_fb_memtype_valid, +- .base.ram = &nv10_ram_oclass, ++ .base.ram = &nv1a_ram_oclass, + .tile.regions = 8, + .tile.init = nv10_fb_tile_init, + .tile.fini = nv10_fb_tile_fini, diff --git a/queue-3.13/drm-nouveau-set-irq_enabled-manually.patch b/queue-3.13/drm-nouveau-set-irq_enabled-manually.patch new file mode 100644 index 00000000000..a998d6bc8c6 --- /dev/null +++ b/queue-3.13/drm-nouveau-set-irq_enabled-manually.patch @@ -0,0 +1,43 @@ +From 7d3428cd4b2ad51af86fdbdf8284ca38fa95e601 Mon Sep 17 00:00:00 2001 +From: Ilia Mirkin +Date: Wed, 29 Jan 2014 19:53:00 -0500 +Subject: drm/nouveau: set irq_enabled manually + +From: Ilia Mirkin + +commit 7d3428cd4b2ad51af86fdbdf8284ca38fa95e601 upstream. + +Since commit 0fa9061ae8c ("drm/nouveau/mc: handle irq-related setup +ourselves"), drm_device->irq_enabled remained unset. This is needed in +order to properly wait for a vblank event in the generic drm code. + +See https://bugs.freedesktop.org/show_bug.cgi?id=74195 + +Reported-by: Jan Janecek +Signed-off-by: Ilia Mirkin +Signed-off-by: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/gpu/drm/nouveau/nouveau_drm.c ++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c +@@ -376,6 +376,8 @@ nouveau_drm_load(struct drm_device *dev, + if (ret) + goto fail_device; + ++ dev->irq_enabled = true; ++ + /* workaround an odd issue on nvc1 by disabling the device's + * nosnoop capability. hopefully won't cause issues until a + * better fix is found - assuming there is one... +@@ -475,6 +477,7 @@ nouveau_drm_remove(struct pci_dev *pdev) + struct nouveau_drm *drm = nouveau_drm(dev); + struct nouveau_object *device; + ++ dev->irq_enabled = false; + device = drm->client.base.device; + drm_put_dev(dev); + diff --git a/queue-3.13/drm-nv50-disp-use-correct-register-to-determine-dp-display-bpp.patch b/queue-3.13/drm-nv50-disp-use-correct-register-to-determine-dp-display-bpp.patch new file mode 100644 index 00000000000..ebc72e5b3db --- /dev/null +++ b/queue-3.13/drm-nv50-disp-use-correct-register-to-determine-dp-display-bpp.patch @@ -0,0 +1,36 @@ +From a7f1c1e65b68e1e1ab70898528d5977ed68a0a7d Mon Sep 17 00:00:00 2001 +From: Ilia Mirkin +Date: Thu, 13 Feb 2014 21:57:15 -0500 +Subject: drm/nv50/disp: use correct register to determine DP display bpp + +From: Ilia Mirkin + +commit a7f1c1e65b68e1e1ab70898528d5977ed68a0a7d upstream. + +Commit 0a0afd282f ("drm/nv50-/disp: move DP link training to core and +train from supervisor") added code that uses the wrong register for +computing the display bpp, used for bandwidth calculation. Adjust to use +the same register as used by exec_clkcmp and nv50_disp_intr_unk20_2_dp. + +Reported-by: Torsten Wagner +Reported-by: Michael Gulick +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67628 +Signed-off-by: Ilia Mirkin +Signed-off-by: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c ++++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +@@ -1112,7 +1112,7 @@ nv50_disp_intr_unk20_2(struct nv50_disp_ + if (conf != ~0) { + if (outp.location == 0 && outp.type == DCB_OUTPUT_DP) { + u32 soff = (ffs(outp.or) - 1) * 0x08; +- u32 ctrl = nv_rd32(priv, 0x610798 + soff); ++ u32 ctrl = nv_rd32(priv, 0x610794 + soff); + u32 datarate; + + switch ((ctrl & 0x000f0000) >> 16) { diff --git a/queue-3.13/drm-radeon-fix-cp-semaphores-on-cik.patch b/queue-3.13/drm-radeon-fix-cp-semaphores-on-cik.patch new file mode 100644 index 00000000000..2bf57f884d0 --- /dev/null +++ b/queue-3.13/drm-radeon-fix-cp-semaphores-on-cik.patch @@ -0,0 +1,119 @@ +From 8f53492f86f9ca66bc762be98f0a9fce9bcb319a Mon Sep 17 00:00:00 2001 +From: Christian König +Date: Tue, 18 Feb 2014 11:37:20 +0100 +Subject: drm/radeon: fix CP semaphores on CIK +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Christian König + +commit 8f53492f86f9ca66bc762be98f0a9fce9bcb319a upstream. + +The CP semaphore queue on CIK has a bug that triggers if uncompleted +waits use the same address while a signal is still pending. Work around +this by using different addresses for each sync. + +Signed-off-by: Christian König +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/radeon.h | 4 +++- + drivers/gpu/drm/radeon/radeon_ring.c | 2 +- + drivers/gpu/drm/radeon/radeon_semaphore.c | 19 ++++++++++++++++--- + 3 files changed, 20 insertions(+), 5 deletions(-) + +--- a/drivers/gpu/drm/radeon/radeon.h ++++ b/drivers/gpu/drm/radeon/radeon.h +@@ -134,6 +134,9 @@ extern int radeon_runtime_pm; + /* R600+ */ + #define R600_RING_TYPE_UVD_INDEX 5 + ++/* number of hw syncs before falling back on blocking */ ++#define RADEON_NUM_SYNCS 4 ++ + /* hardcode those limit for now */ + #define RADEON_VA_IB_OFFSET (1 << 20) + #define RADEON_VA_RESERVED_SIZE (8 << 20) +@@ -544,7 +547,6 @@ int radeon_mode_dumb_mmap(struct drm_fil + /* + * Semaphores. + */ +-/* everything here is constant */ + struct radeon_semaphore { + struct radeon_sa_bo *sa_bo; + signed waiters; +--- a/drivers/gpu/drm/radeon/radeon_ring.c ++++ b/drivers/gpu/drm/radeon/radeon_ring.c +@@ -139,7 +139,7 @@ int radeon_ib_schedule(struct radeon_dev + } + + /* 64 dwords should be enough for fence too */ +- r = radeon_ring_lock(rdev, ring, 64 + RADEON_NUM_RINGS * 8); ++ r = radeon_ring_lock(rdev, ring, 64 + RADEON_NUM_SYNCS * 8); + if (r) { + dev_err(rdev->dev, "scheduling IB failed (%d).\n", r); + return r; +--- a/drivers/gpu/drm/radeon/radeon_semaphore.c ++++ b/drivers/gpu/drm/radeon/radeon_semaphore.c +@@ -34,14 +34,15 @@ + int radeon_semaphore_create(struct radeon_device *rdev, + struct radeon_semaphore **semaphore) + { ++ uint32_t *cpu_addr; + int i, r; + + *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); + if (*semaphore == NULL) { + return -ENOMEM; + } +- r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, +- &(*semaphore)->sa_bo, 8, 8, true); ++ r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &(*semaphore)->sa_bo, ++ 8 * RADEON_NUM_SYNCS, 8, true); + if (r) { + kfree(*semaphore); + *semaphore = NULL; +@@ -49,7 +50,10 @@ int radeon_semaphore_create(struct radeo + } + (*semaphore)->waiters = 0; + (*semaphore)->gpu_addr = radeon_sa_bo_gpu_addr((*semaphore)->sa_bo); +- *((uint64_t*)radeon_sa_bo_cpu_addr((*semaphore)->sa_bo)) = 0; ++ ++ cpu_addr = radeon_sa_bo_cpu_addr((*semaphore)->sa_bo); ++ for (i = 0; i < RADEON_NUM_SYNCS; ++i) ++ cpu_addr[i] = 0; + + for (i = 0; i < RADEON_NUM_RINGS; ++i) + (*semaphore)->sync_to[i] = NULL; +@@ -125,6 +129,7 @@ int radeon_semaphore_sync_rings(struct r + struct radeon_semaphore *semaphore, + int ring) + { ++ unsigned count = 0; + int i, r; + + for (i = 0; i < RADEON_NUM_RINGS; ++i) { +@@ -140,6 +145,12 @@ int radeon_semaphore_sync_rings(struct r + return -EINVAL; + } + ++ if (++count > RADEON_NUM_SYNCS) { ++ /* not enough room, wait manually */ ++ radeon_fence_wait_locked(fence); ++ continue; ++ } ++ + /* allocate enough space for sync command */ + r = radeon_ring_alloc(rdev, &rdev->ring[i], 16); + if (r) { +@@ -164,6 +175,8 @@ int radeon_semaphore_sync_rings(struct r + + radeon_ring_commit(rdev, &rdev->ring[i]); + radeon_fence_note_sync(fence, ring); ++ ++ semaphore->gpu_addr += 8; + } + + return 0; diff --git a/queue-3.13/drm-radeon-fix-display-tiling-setup-on-si.patch b/queue-3.13/drm-radeon-fix-display-tiling-setup-on-si.patch new file mode 100644 index 00000000000..4d47d465e20 --- /dev/null +++ b/queue-3.13/drm-radeon-fix-display-tiling-setup-on-si.patch @@ -0,0 +1,56 @@ +From 6d8ea7de3f5035610f3bfacbe35e7b71ad1e4663 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Mon, 17 Feb 2014 14:16:31 -0500 +Subject: drm/radeon: fix display tiling setup on SI + +From: Alex Deucher + +commit 6d8ea7de3f5035610f3bfacbe35e7b71ad1e4663 upstream. + +Apply the same logic as CI to SI for setting up the +display tiling parameters. The num banks may vary +per tiling index just like CI. + +Bugs: +https://bugs.freedesktop.org/show_bug.cgi?id=71488 +https://bugs.freedesktop.org/show_bug.cgi?id=73946 +https://bugs.freedesktop.org/show_bug.cgi?id=74927 + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/atombios_crtc.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/gpu/drm/radeon/atombios_crtc.c ++++ b/drivers/gpu/drm/radeon/atombios_crtc.c +@@ -1169,7 +1169,7 @@ static int dce4_crtc_do_set_base(struct + evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split); + + /* Set NUM_BANKS. */ +- if (rdev->family >= CHIP_BONAIRE) { ++ if (rdev->family >= CHIP_TAHITI) { + unsigned tileb, index, num_banks, tile_split_bytes; + + /* Calculate the macrotile mode index. */ +@@ -1187,13 +1187,14 @@ static int dce4_crtc_do_set_base(struct + return -EINVAL; + } + +- num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3; ++ if (rdev->family >= CHIP_BONAIRE) ++ num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3; ++ else ++ num_banks = (rdev->config.si.tile_mode_array[index] >> 20) & 0x3; + fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks); + } else { +- /* SI and older. */ +- if (rdev->family >= CHIP_TAHITI) +- tmp = rdev->config.si.tile_config; +- else if (rdev->family >= CHIP_CAYMAN) ++ /* NI and older. */ ++ if (rdev->family >= CHIP_CAYMAN) + tmp = rdev->config.cayman.tile_config; + else + tmp = rdev->config.evergreen.tile_config; diff --git a/queue-3.13/drm-radeon-ni-fix-typo-in-dpm-sq-ramping-setup.patch b/queue-3.13/drm-radeon-ni-fix-typo-in-dpm-sq-ramping-setup.patch new file mode 100644 index 00000000000..af36e143c9d --- /dev/null +++ b/queue-3.13/drm-radeon-ni-fix-typo-in-dpm-sq-ramping-setup.patch @@ -0,0 +1,29 @@ +From 21ed4947fdfe19b60a27b84162622e56439c7937 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Tue, 18 Feb 2014 10:16:28 -0500 +Subject: drm/radeon/ni: fix typo in dpm sq ramping setup + +From: Alex Deucher + +commit 21ed4947fdfe19b60a27b84162622e56439c7937 upstream. + +inverted logic. + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/ni_dpm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/radeon/ni_dpm.c ++++ b/drivers/gpu/drm/radeon/ni_dpm.c +@@ -2586,7 +2586,7 @@ static int ni_populate_sq_ramping_values + if (NISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT)) + enable_sq_ramping = false; + +- if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO <= (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) ++ if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO > (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) + enable_sq_ramping = false; + + for (i = 0; i < state->performance_level_count; i++) { diff --git a/queue-3.13/ext4-don-t-leave-i_crtime.tv_sec-uninitialized.patch b/queue-3.13/ext4-don-t-leave-i_crtime.tv_sec-uninitialized.patch new file mode 100644 index 00000000000..41298c27520 --- /dev/null +++ b/queue-3.13/ext4-don-t-leave-i_crtime.tv_sec-uninitialized.patch @@ -0,0 +1,33 @@ +From 19ea80603715d473600cd993b9987bc97d042e02 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sun, 16 Feb 2014 19:29:32 -0500 +Subject: ext4: don't leave i_crtime.tv_sec uninitialized + +From: Theodore Ts'o + +commit 19ea80603715d473600cd993b9987bc97d042e02 upstream. + +If the i_crtime field is not present in the inode, don't leave the +field uninitialized. + +Fixes: ef7f38359 ("ext4: Add nanosecond timestamps") +Reported-by: Vegard Nossum +Tested-by: Vegard Nossum +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/ext4.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/fs/ext4/ext4.h ++++ b/fs/ext4/ext4.h +@@ -771,6 +771,8 @@ do { \ + if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ + (einode)->xtime.tv_sec = \ + (signed)le32_to_cpu((raw_inode)->xtime); \ ++ else \ ++ (einode)->xtime.tv_sec = 0; \ + if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ + ext4_decode_extra_time(&(einode)->xtime, \ + raw_inode->xtime ## _extra); \ diff --git a/queue-3.13/ext4-don-t-try-to-modify-s_flags-if-the-the-file-system-is-read-only.patch b/queue-3.13/ext4-don-t-try-to-modify-s_flags-if-the-the-file-system-is-read-only.patch new file mode 100644 index 00000000000..98c6a57b8e7 --- /dev/null +++ b/queue-3.13/ext4-don-t-try-to-modify-s_flags-if-the-the-file-system-is-read-only.patch @@ -0,0 +1,55 @@ +From 23301410972330c0ae9a8afc379ba2005e249cc6 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Wed, 12 Feb 2014 12:16:04 -0500 +Subject: ext4: don't try to modify s_flags if the the file system is read-only + +From: Theodore Ts'o + +commit 23301410972330c0ae9a8afc379ba2005e249cc6 upstream. + +If an ext4 file system is created by some tool other than mke2fs +(perhaps by someone who has a pathalogical fear of the GPL) that +doesn't set one or the other of the EXT2_FLAGS_{UN}SIGNED_HASH flags, +and that file system is then mounted read-only, don't try to modify +the s_flags field. Otherwise, if dm_verity is in use, the superblock +will change, causing an dm_verity failure. + +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/super.c | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -3695,16 +3695,22 @@ static int ext4_fill_super(struct super_ + for (i = 0; i < 4; i++) + sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); + sbi->s_def_hash_version = es->s_def_hash_version; +- i = le32_to_cpu(es->s_flags); +- if (i & EXT2_FLAGS_UNSIGNED_HASH) +- sbi->s_hash_unsigned = 3; +- else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { ++ if (EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) { ++ i = le32_to_cpu(es->s_flags); ++ if (i & EXT2_FLAGS_UNSIGNED_HASH) ++ sbi->s_hash_unsigned = 3; ++ else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { + #ifdef __CHAR_UNSIGNED__ +- es->s_flags |= cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); +- sbi->s_hash_unsigned = 3; ++ if (!(sb->s_flags & MS_RDONLY)) ++ es->s_flags |= ++ cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); ++ sbi->s_hash_unsigned = 3; + #else +- es->s_flags |= cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); ++ if (!(sb->s_flags & MS_RDONLY)) ++ es->s_flags |= ++ cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); + #endif ++ } + } + + /* Handle clustersize */ diff --git a/queue-3.13/ext4-fix-error-paths-in-swap_inode_boot_loader.patch b/queue-3.13/ext4-fix-error-paths-in-swap_inode_boot_loader.patch new file mode 100644 index 00000000000..5fc8b4c83a2 --- /dev/null +++ b/queue-3.13/ext4-fix-error-paths-in-swap_inode_boot_loader.patch @@ -0,0 +1,43 @@ +From 30d29b119ef01776e0a301444ab24defe8d8bef3 Mon Sep 17 00:00:00 2001 +From: Zheng Liu +Date: Wed, 12 Feb 2014 11:48:31 -0500 +Subject: ext4: fix error paths in swap_inode_boot_loader() + +From: Zheng Liu + +commit 30d29b119ef01776e0a301444ab24defe8d8bef3 upstream. + +In swap_inode_boot_loader() we forgot to release ->i_mutex and resume +unlocked dio for inode and inode_bl if there is an error starting the +journal handle. This commit fixes this issue. + +Reported-by: Ahmed Tamrawi +Cc: Andreas Dilger +Cc: Dr. Tilmann Bubeck +Signed-off-by: Zheng Liu +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/ioctl.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/fs/ext4/ioctl.c ++++ b/fs/ext4/ioctl.c +@@ -144,7 +144,7 @@ static long swap_inode_boot_loader(struc + handle = ext4_journal_start(inode_bl, EXT4_HT_MOVE_EXTENTS, 2); + if (IS_ERR(handle)) { + err = -EINVAL; +- goto swap_boot_out; ++ goto journal_err_out; + } + + /* Protect extent tree against block allocations via delalloc */ +@@ -202,6 +202,7 @@ static long swap_inode_boot_loader(struc + + ext4_double_up_write_data_sem(inode, inode_bl); + ++journal_err_out: + ext4_inode_resume_unlocked_dio(inode); + ext4_inode_resume_unlocked_dio(inode_bl); + diff --git a/queue-3.13/ext4-fix-online-resize-with-a-non-standard-blocks-per-group-setting.patch b/queue-3.13/ext4-fix-online-resize-with-a-non-standard-blocks-per-group-setting.patch new file mode 100644 index 00000000000..1f5914f2185 --- /dev/null +++ b/queue-3.13/ext4-fix-online-resize-with-a-non-standard-blocks-per-group-setting.patch @@ -0,0 +1,37 @@ +From 3d2660d0c9c2f296837078c189b68a47f6b2e3b5 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 15 Feb 2014 22:42:25 -0500 +Subject: ext4: fix online resize with a non-standard blocks per group setting + +From: Theodore Ts'o + +commit 3d2660d0c9c2f296837078c189b68a47f6b2e3b5 upstream. + +The set_flexbg_block_bitmap() function assumed that the number of +blocks in a blockgroup was sb->blocksize * 8, which is normally true, +but not always! Use EXT4_BLOCKS_PER_GROUP(sb) instead, to fix block +bitmap corruption after: + +mke2fs -t ext4 -g 3072 -i 4096 /dev/vdd 1G +mount -t ext4 /dev/vdd /vdd +resize2fs /dev/vdd 8G + +Signed-off-by: "Theodore Ts'o" +Reported-by: Jon Bernard +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/resize.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -409,7 +409,7 @@ static int set_flexbg_block_bitmap(struc + start = ext4_group_first_block_no(sb, group); + group -= flex_gd->groups[0].group; + +- count2 = sb->s_blocksize * 8 - (block - start); ++ count2 = EXT4_BLOCKS_PER_GROUP(sb) - (block - start); + if (count2 > count) + count2 = count; + diff --git a/queue-3.13/ext4-fix-online-resize-with-very-large-inode-tables.patch b/queue-3.13/ext4-fix-online-resize-with-very-large-inode-tables.patch new file mode 100644 index 00000000000..01cdaddd618 --- /dev/null +++ b/queue-3.13/ext4-fix-online-resize-with-very-large-inode-tables.patch @@ -0,0 +1,133 @@ +From b93c95353413041a8cebad915a8109619f66bcc6 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 15 Feb 2014 21:33:13 -0500 +Subject: ext4: fix online resize with very large inode tables + +From: Theodore Ts'o + +commit b93c95353413041a8cebad915a8109619f66bcc6 upstream. + +If a file system has a large number of inodes per block group, all of +the metadata blocks in a flex_bg may be larger than what can fit in a +single block group. Unfortunately, ext4_alloc_group_tables() in +resize.c was never tested to see if it would handle this case +correctly, and there were a large number of bugs which caused the +following sequence to result in a BUG_ON: + +kernel bug at fs/ext4/resize.c:409! + ... +call trace: + [] ext4_flex_group_add+0x1448/0x1830 + [] ext4_resize_fs+0x7b2/0xe80 + [] ext4_ioctl+0xbf0/0xf00 + [] do_vfs_ioctl+0x2dd/0x4b0 + [] ? final_putname+0x22/0x50 + [] sys_ioctl+0x81/0xa0 + [] system_call_fastpath+0x16/0x1b +code: c8 4c 89 df e8 41 96 f8 ff 44 89 e8 49 01 c4 44 29 6d d4 0 +rip [] set_flexbg_block_bitmap+0x171/0x180 + + +This can be reproduced with the following command sequence: + + mke2fs -t ext4 -i 4096 /dev/vdd 1G + mount -t ext4 /dev/vdd /vdd + resize2fs /dev/vdd 8G + +To fix this, we need to make sure the right thing happens when a block +group's inode table straddles two block groups, which means the +following bugs had to be fixed: + +1) Not clearing the BLOCK_UNINIT flag in the second block group in + ext4_alloc_group_tables --- the was proximate cause of the BUG_ON. + +2) Incorrectly determining how many block groups contained contiguous + free blocks in ext4_alloc_group_tables(). + +3) Incorrectly setting the start of the next block range to be marked + in use after a discontinuity in setup_new_flex_group_blocks(). + +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/resize.c | 32 ++++++++++++++++++++------------ + 1 file changed, 20 insertions(+), 12 deletions(-) + +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -243,6 +243,7 @@ static int ext4_alloc_group_tables(struc + ext4_group_t group; + ext4_group_t last_group; + unsigned overhead; ++ __u16 uninit_mask = (flexbg_size > 1) ? ~EXT4_BG_BLOCK_UNINIT : ~0; + + BUG_ON(flex_gd->count == 0 || group_data == NULL); + +@@ -266,7 +267,7 @@ next_group: + src_group++; + for (; src_group <= last_group; src_group++) { + overhead = ext4_group_overhead_blocks(sb, src_group); +- if (overhead != 0) ++ if (overhead == 0) + last_blk += group_data[src_group - group].blocks_count; + else + break; +@@ -280,8 +281,7 @@ next_group: + group = ext4_get_group_number(sb, start_blk - 1); + group -= group_data[0].group; + group_data[group].free_blocks_count--; +- if (flexbg_size > 1) +- flex_gd->bg_flags[group] &= ~EXT4_BG_BLOCK_UNINIT; ++ flex_gd->bg_flags[group] &= uninit_mask; + } + + /* Allocate inode bitmaps */ +@@ -292,22 +292,30 @@ next_group: + group = ext4_get_group_number(sb, start_blk - 1); + group -= group_data[0].group; + group_data[group].free_blocks_count--; +- if (flexbg_size > 1) +- flex_gd->bg_flags[group] &= ~EXT4_BG_BLOCK_UNINIT; ++ flex_gd->bg_flags[group] &= uninit_mask; + } + + /* Allocate inode tables */ + for (; it_index < flex_gd->count; it_index++) { +- if (start_blk + EXT4_SB(sb)->s_itb_per_group > last_blk) ++ unsigned int itb = EXT4_SB(sb)->s_itb_per_group; ++ ext4_fsblk_t next_group_start; ++ ++ if (start_blk + itb > last_blk) + goto next_group; + group_data[it_index].inode_table = start_blk; +- group = ext4_get_group_number(sb, start_blk - 1); ++ group = ext4_get_group_number(sb, start_blk); ++ next_group_start = ext4_group_first_block_no(sb, group + 1); + group -= group_data[0].group; +- group_data[group].free_blocks_count -= +- EXT4_SB(sb)->s_itb_per_group; +- if (flexbg_size > 1) +- flex_gd->bg_flags[group] &= ~EXT4_BG_BLOCK_UNINIT; + ++ if (start_blk + itb > next_group_start) { ++ flex_gd->bg_flags[group + 1] &= uninit_mask; ++ overhead = start_blk + itb - next_group_start; ++ group_data[group + 1].free_blocks_count -= overhead; ++ itb -= overhead; ++ } ++ ++ group_data[group].free_blocks_count -= itb; ++ flex_gd->bg_flags[group] &= uninit_mask; + start_blk += EXT4_SB(sb)->s_itb_per_group; + } + +@@ -620,7 +628,7 @@ handle_ib: + if (err) + goto out; + count = group_table_count[j]; +- start = group_data[i].block_bitmap; ++ start = (&group_data[i].block_bitmap)[j]; + block = start; + } + diff --git a/queue-3.13/ext4-fix-xfstest-generic-299-block-validity-failures.patch b/queue-3.13/ext4-fix-xfstest-generic-299-block-validity-failures.patch new file mode 100644 index 00000000000..9162c8dff8d --- /dev/null +++ b/queue-3.13/ext4-fix-xfstest-generic-299-block-validity-failures.patch @@ -0,0 +1,52 @@ +From 15cc17678547676c82a5da9ccf357447333fc342 Mon Sep 17 00:00:00 2001 +From: Eric Whitney +Date: Wed, 12 Feb 2014 10:42:45 -0500 +Subject: ext4: fix xfstest generic/299 block validity failures + +From: Eric Whitney + +commit 15cc17678547676c82a5da9ccf357447333fc342 upstream. + +Commit a115f749c1 (ext4: remove wait for unwritten extent conversion from +ext4_truncate) exposed a bug in ext4_ext_handle_uninitialized_extents(). +It can be triggered by xfstest generic/299 when run on a test file +system created without a journal. This test continuously fallocates and +truncates files to which random dio/aio writes are simultaneously +performed by a separate process. The test completes successfully, but +if the test filesystem is mounted with the block_validity option, a +warning message stating that a logical block has been mapped to an +illegal physical block is posted in the kernel log. + +The bug occurs when an extent is being converted to the written state +by ext4_end_io_dio() and ext4_ext_handle_uninitialized_extents() +discovers a mapping for an existing uninitialized extent. Although it +sets EXT4_MAP_MAPPED in map->m_flags, it fails to set map->m_pblk to +the discovered physical block number. Because map->m_pblk is not +otherwise initialized or set by this function or its callers, its +uninitialized value is returned to ext4_map_blocks(), where it is +stored as a bogus mapping in the extent status tree. + +Since map->m_pblk can accidentally contain illegal values that are +larger than the physical size of the file system, calls to +check_block_validity() in ext4_map_blocks() that are enabled if the +block_validity mount option is used can fail, resulting in the logged +warning message. + +Signed-off-by: Eric Whitney +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/extents.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/fs/ext4/extents.c ++++ b/fs/ext4/extents.c +@@ -3906,6 +3906,7 @@ ext4_ext_handle_uninitialized_extents(ha + } else + err = ret; + map->m_flags |= EXT4_MAP_MAPPED; ++ map->m_pblk = newblock; + if (allocated > map->m_len) + allocated = map->m_len; + map->m_len = allocated; diff --git a/queue-3.13/series b/queue-3.13/series new file mode 100644 index 00000000000..89969f8fa08 --- /dev/null +++ b/queue-3.13/series @@ -0,0 +1,14 @@ +drm-radeon-ni-fix-typo-in-dpm-sq-ramping-setup.patch +drm-radeon-fix-display-tiling-setup-on-si.patch +drm-radeon-fix-cp-semaphores-on-cik.patch +drm-nouveau-set-irq_enabled-manually.patch +drm-nouveau-fb-use-correct-ram-oclass-for-nv1a-hardware.patch +drm-nv50-disp-use-correct-register-to-determine-dp-display-bpp.patch +drm-i915-add-intel_ring_cachline_align.patch +drm-i915-prevent-mi_display_flip-straddling-two-cachelines-on-ivb.patch +ext4-fix-xfstest-generic-299-block-validity-failures.patch +ext4-fix-error-paths-in-swap_inode_boot_loader.patch +ext4-don-t-try-to-modify-s_flags-if-the-the-file-system-is-read-only.patch +ext4-fix-online-resize-with-very-large-inode-tables.patch +ext4-fix-online-resize-with-a-non-standard-blocks-per-group-setting.patch +ext4-don-t-leave-i_crtime.tv_sec-uninitialized.patch