From: Greg Kroah-Hartman Date: Thu, 23 May 2019 18:00:53 +0000 (+0200) Subject: 4.4-stable patches X-Git-Tag: v5.1.5~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=811ef89167747dfe0e409afa89616d8f57c5b2b8;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: btrfs-honour-fitrim-range-constraints-during-free-space-trim.patch md-raid-raid5-preserve-the-writeback-action-after-the-parity-check.patch revert-don-t-jump-to-compute_result-state-from-check_result-state.patch --- diff --git a/queue-4.4/btrfs-honour-fitrim-range-constraints-during-free-space-trim.patch b/queue-4.4/btrfs-honour-fitrim-range-constraints-during-free-space-trim.patch new file mode 100644 index 00000000000..1a437828c14 --- /dev/null +++ b/queue-4.4/btrfs-honour-fitrim-range-constraints-during-free-space-trim.patch @@ -0,0 +1,91 @@ +From c2d1b3aae33605a61cbab445d8ae1c708ccd2698 Mon Sep 17 00:00:00 2001 +From: Nikolay Borisov +Date: Mon, 25 Mar 2019 14:31:21 +0200 +Subject: btrfs: Honour FITRIM range constraints during free space trim + +From: Nikolay Borisov + +commit c2d1b3aae33605a61cbab445d8ae1c708ccd2698 upstream. + +Up until now trimming the freespace was done irrespective of what the +arguments of the FITRIM ioctl were. For example fstrim's -o/-l arguments +will be entirely ignored. Fix it by correctly handling those paramter. +This requires breaking if the found freespace extent is after the end of +the passed range as well as completing trim after trimming +fstrim_range::len bytes. + +Fixes: 499f377f49f0 ("btrfs: iterate over unused chunk space in FITRIM") +CC: stable@vger.kernel.org # 4.4+ +Signed-off-by: Nikolay Borisov +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + + +--- + fs/btrfs/extent-tree.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) + +--- a/fs/btrfs/extent-tree.c ++++ b/fs/btrfs/extent-tree.c +@@ -10730,9 +10730,9 @@ int btrfs_error_unpin_extent_range(struc + * transaction. + */ + static int btrfs_trim_free_extents(struct btrfs_device *device, +- u64 minlen, u64 *trimmed) ++ struct fstrim_range *range, u64 *trimmed) + { +- u64 start = 0, len = 0; ++ u64 start = range->start, len = 0; + int ret; + + *trimmed = 0; +@@ -10768,8 +10768,8 @@ static int btrfs_trim_free_extents(struc + atomic_inc(&trans->use_count); + spin_unlock(&fs_info->trans_lock); + +- ret = find_free_dev_extent_start(trans, device, minlen, start, +- &start, &len); ++ ret = find_free_dev_extent_start(trans, device, range->minlen, ++ start, &start, &len); + if (trans) + btrfs_put_transaction(trans); + +@@ -10781,6 +10781,16 @@ static int btrfs_trim_free_extents(struc + break; + } + ++ /* If we are out of the passed range break */ ++ if (start > range->start + range->len - 1) { ++ mutex_unlock(&fs_info->chunk_mutex); ++ ret = 0; ++ break; ++ } ++ ++ start = max(range->start, start); ++ len = min(range->len, len); ++ + ret = btrfs_issue_discard(device->bdev, start, len, &bytes); + up_read(&fs_info->commit_root_sem); + mutex_unlock(&fs_info->chunk_mutex); +@@ -10791,6 +10801,10 @@ static int btrfs_trim_free_extents(struc + start += len; + *trimmed += bytes; + ++ /* We've trimmed enough */ ++ if (*trimmed >= range->len) ++ break; ++ + if (fatal_signal_pending(current)) { + ret = -ERESTARTSYS; + break; +@@ -10857,8 +10871,7 @@ int btrfs_trim_fs(struct btrfs_root *roo + mutex_lock(&root->fs_info->fs_devices->device_list_mutex); + devices = &root->fs_info->fs_devices->devices; + list_for_each_entry(device, devices, dev_list) { +- ret = btrfs_trim_free_extents(device, range->minlen, +- &group_trimmed); ++ ret = btrfs_trim_free_extents(device, range, &group_trimmed); + if (ret) + break; + diff --git a/queue-4.4/kvm-arm-arm64-ensure-vcpu-target-is-unset-on-reset-f.patch b/queue-4.4/kvm-arm-arm64-ensure-vcpu-target-is-unset-on-reset-f.patch index 2644c357ae5..a3f6d0dc350 100644 --- a/queue-4.4/kvm-arm-arm64-ensure-vcpu-target-is-unset-on-reset-f.patch +++ b/queue-4.4/kvm-arm-arm64-ensure-vcpu-target-is-unset-on-reset-f.patch @@ -17,14 +17,12 @@ Signed-off-by: Andrew Jones Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin --- - arch/arm/kvm/arm.c | 11 ++++++++--- + arch/arm/kvm/arm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c -index d7bef2144760c..e96ddc599c303 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c -@@ -744,7 +744,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level, +@@ -744,7 +744,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kv static int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, const struct kvm_vcpu_init *init) { @@ -33,7 +31,7 @@ index d7bef2144760c..e96ddc599c303 100644 int phys_target = kvm_target_cpu(); if (init->target != phys_target) -@@ -779,9 +779,14 @@ static int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, +@@ -779,9 +779,14 @@ static int kvm_vcpu_set_target(struct kv vcpu->arch.target = phys_target; /* Now we know what it is, we can reset it. */ @@ -50,6 +48,3 @@ index d7bef2144760c..e96ddc599c303 100644 static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu, struct kvm_vcpu_init *init) --- -2.20.1 - diff --git a/queue-4.4/md-raid-raid5-preserve-the-writeback-action-after-the-parity-check.patch b/queue-4.4/md-raid-raid5-preserve-the-writeback-action-after-the-parity-check.patch new file mode 100644 index 00000000000..c46288fefb9 --- /dev/null +++ b/queue-4.4/md-raid-raid5-preserve-the-writeback-action-after-the-parity-check.patch @@ -0,0 +1,52 @@ +From b2176a1dfb518d870ee073445d27055fea64dfb8 Mon Sep 17 00:00:00 2001 +From: Nigel Croxon +Date: Tue, 16 Apr 2019 09:50:09 -0700 +Subject: md/raid: raid5 preserve the writeback action after the parity check + +From: Nigel Croxon + +commit b2176a1dfb518d870ee073445d27055fea64dfb8 upstream. + +The problem is that any 'uptodate' vs 'disks' check is not precise +in this path. Put a "WARN_ON(!test_bit(R5_UPTODATE, &dev->flags)" on the +device that might try to kick off writes and then skip the action. +Better to prevent the raid driver from taking unexpected action *and* keep +the system alive vs killing the machine with BUG_ON. + +Note: fixed warning reported by kbuild test robot + +Signed-off-by: Dan Williams +Signed-off-by: Nigel Croxon +Signed-off-by: Song Liu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/raid5.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/md/raid5.c ++++ b/drivers/md/raid5.c +@@ -3861,7 +3861,7 @@ static void handle_parity_checks6(struct + /* now write out any block on a failed drive, + * or P or Q if they were recomputed + */ +- BUG_ON(s->uptodate < disks - 1); /* We don't need Q to recover */ ++ dev = NULL; + if (s->failed == 2) { + dev = &sh->dev[s->failed_num[1]]; + s->locked++; +@@ -3886,6 +3886,14 @@ static void handle_parity_checks6(struct + set_bit(R5_LOCKED, &dev->flags); + set_bit(R5_Wantwrite, &dev->flags); + } ++ if (WARN_ONCE(dev && !test_bit(R5_UPTODATE, &dev->flags), ++ "%s: disk%td not up to date\n", ++ mdname(conf->mddev), ++ dev - (struct r5dev *) &sh->dev)) { ++ clear_bit(R5_LOCKED, &dev->flags); ++ clear_bit(R5_Wantwrite, &dev->flags); ++ s->locked--; ++ } + clear_bit(STRIPE_DEGRADED, &sh->state); + + set_bit(STRIPE_INSYNC, &sh->state); diff --git a/queue-4.4/revert-don-t-jump-to-compute_result-state-from-check_result-state.patch b/queue-4.4/revert-don-t-jump-to-compute_result-state-from-check_result-state.patch new file mode 100644 index 00000000000..6f99ba29e2f --- /dev/null +++ b/queue-4.4/revert-don-t-jump-to-compute_result-state-from-check_result-state.patch @@ -0,0 +1,54 @@ +From a25d8c327bb41742dbd59f8c545f59f3b9c39983 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Tue, 16 Apr 2019 09:34:21 -0700 +Subject: Revert "Don't jump to compute_result state from check_result state" + +From: Song Liu + +commit a25d8c327bb41742dbd59f8c545f59f3b9c39983 upstream. + +This reverts commit 4f4fd7c5798bbdd5a03a60f6269cf1177fbd11ef. + +Cc: Dan Williams +Cc: Nigel Croxon +Cc: Xiao Ni +Signed-off-by: Song Liu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/raid5.c | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +--- a/drivers/md/raid5.c ++++ b/drivers/md/raid5.c +@@ -3897,15 +3897,26 @@ static void handle_parity_checks6(struct + case check_state_check_result: + sh->check_state = check_state_idle; + +- if (s->failed > 1) +- break; + /* handle a successful check operation, if parity is correct + * we are done. Otherwise update the mismatch count and repair + * parity if !MD_RECOVERY_CHECK + */ + if (sh->ops.zero_sum_result == 0) { +- /* Any parity checked was correct */ +- set_bit(STRIPE_INSYNC, &sh->state); ++ /* both parities are correct */ ++ if (!s->failed) ++ set_bit(STRIPE_INSYNC, &sh->state); ++ else { ++ /* in contrast to the raid5 case we can validate ++ * parity, but still have a failure to write ++ * back ++ */ ++ sh->check_state = check_state_compute_result; ++ /* Returning at this point means that we may go ++ * off and bring p and/or q uptodate again so ++ * we make sure to check zero_sum_result again ++ * to verify if p or q need writeback ++ */ ++ } + } else { + atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches); + if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) diff --git a/queue-4.4/series b/queue-4.4/series index de2d2341d9e..98300d77410 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -70,3 +70,6 @@ kvm-arm-arm64-ensure-vcpu-target-is-unset-on-reset-f.patch power-supply-sysfs-prevent-endless-uevent-loop-with-.patch ufs-fix-braino-in-ufs_get_inode_gid-for-solaris-ufs-.patch perf-bench-numa-add-define-for-rusage_thread-if-not-.patch +revert-don-t-jump-to-compute_result-state-from-check_result-state.patch +md-raid-raid5-preserve-the-writeback-action-after-the-parity-check.patch +btrfs-honour-fitrim-range-constraints-during-free-space-trim.patch diff --git a/queue-4.4/vti4-ipip-tunnel-deregistration-fixes.patch b/queue-4.4/vti4-ipip-tunnel-deregistration-fixes.patch index a0ef240f281..d08d8ab1ea6 100644 --- a/queue-4.4/vti4-ipip-tunnel-deregistration-fixes.patch +++ b/queue-4.4/vti4-ipip-tunnel-deregistration-fixes.patch @@ -16,11 +16,9 @@ Signed-off-by: Jeremy Sowden Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- - net/ipv4/ip_vti.c | 5 +++-- + net/ipv4/ip_vti.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c -index fcf327ebd1345..bbcbbc1cc2cc6 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c @@ -648,9 +648,9 @@ static int __init vti_init(void) @@ -43,6 +41,3 @@ index fcf327ebd1345..bbcbbc1cc2cc6 100644 xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP); xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH); xfrm4_protocol_deregister(&vti_esp4_protocol, IPPROTO_ESP); --- -2.20.1 - diff --git a/queue-4.4/xfrm-policy-fix-out-of-bound-array-accesses-in-__xfr.patch b/queue-4.4/xfrm-policy-fix-out-of-bound-array-accesses-in-__xfr.patch index 6c9a3917690..1236106da1f 100644 --- a/queue-4.4/xfrm-policy-fix-out-of-bound-array-accesses-in-__xfr.patch +++ b/queue-4.4/xfrm-policy-fix-out-of-bound-array-accesses-in-__xfr.patch @@ -68,14 +68,12 @@ Acked-by: Herbert Xu Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- - net/xfrm/xfrm_user.c | 2 +- + net/xfrm/xfrm_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c -index 177a6c75f136b..b04c030439762 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c -@@ -1340,7 +1340,7 @@ static int verify_newpolicy_info(struct xfrm_userpolicy_info *p) +@@ -1340,7 +1340,7 @@ static int verify_newpolicy_info(struct ret = verify_policy_dir(p->dir); if (ret) return ret; @@ -84,6 +82,3 @@ index 177a6c75f136b..b04c030439762 100644 return -EINVAL; return 0; --- -2.20.1 - diff --git a/queue-4.4/xfrm6_tunnel-fix-potential-panic-when-unloading-xfrm.patch b/queue-4.4/xfrm6_tunnel-fix-potential-panic-when-unloading-xfrm.patch index b006daaf728..aa8fa263f2d 100644 --- a/queue-4.4/xfrm6_tunnel-fix-potential-panic-when-unloading-xfrm.patch +++ b/queue-4.4/xfrm6_tunnel-fix-potential-panic-when-unloading-xfrm.patch @@ -15,14 +15,12 @@ Acked-by: Herbert Xu Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- - net/ipv6/xfrm6_tunnel.c | 4 ++++ + net/ipv6/xfrm6_tunnel.c | 4 ++++ 1 file changed, 4 insertions(+) -diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c -index 56b72cada346f..f9d493c59d6c1 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c -@@ -391,6 +391,10 @@ static void __exit xfrm6_tunnel_fini(void) +@@ -391,6 +391,10 @@ static void __exit xfrm6_tunnel_fini(voi xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); unregister_pernet_subsys(&xfrm6_tunnel_net_ops); @@ -33,6 +31,3 @@ index 56b72cada346f..f9d493c59d6c1 100644 kmem_cache_destroy(xfrm6_tunnel_spi_kmem); } --- -2.20.1 -