]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Jun 2022 11:58:26 +0000 (13:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Jun 2022 11:58:26 +0000 (13:58 +0200)
added patches:
bfq-split-shared-queues-on-move-between-cgroups.patch
bfq-track-whether-bfq_group-is-still-online.patch
bfq-update-cgroup-information-before-merging-bio.patch
efi-do-not-import-certificates-from-uefi-secure-boot-for-t2-macs.patch
fs-writeback-writeback_sb_inodes-recalculate-wrote-according-skipped-pages.patch

queue-5.10/bfq-split-shared-queues-on-move-between-cgroups.patch [new file with mode: 0644]
queue-5.10/bfq-track-whether-bfq_group-is-still-online.patch [new file with mode: 0644]
queue-5.10/bfq-update-cgroup-information-before-merging-bio.patch [new file with mode: 0644]
queue-5.10/efi-do-not-import-certificates-from-uefi-secure-boot-for-t2-macs.patch [new file with mode: 0644]
queue-5.10/fs-writeback-writeback_sb_inodes-recalculate-wrote-according-skipped-pages.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/bfq-split-shared-queues-on-move-between-cgroups.patch b/queue-5.10/bfq-split-shared-queues-on-move-between-cgroups.patch
new file mode 100644 (file)
index 0000000..425ec1f
--- /dev/null
@@ -0,0 +1,99 @@
+From 3bc5e683c67d94bd839a1da2e796c15847b51b69 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Fri, 1 Apr 2022 12:27:44 +0200
+Subject: bfq: Split shared queues on move between cgroups
+
+From: Jan Kara <jack@suse.cz>
+
+commit 3bc5e683c67d94bd839a1da2e796c15847b51b69 upstream.
+
+When bfqq is shared by multiple processes it can happen that one of the
+processes gets moved to a different cgroup (or just starts submitting IO
+for different cgroup). In case that happens we need to split the merged
+bfqq as otherwise we will have IO for multiple cgroups in one bfqq and
+we will just account IO time to wrong entities etc.
+
+Similarly if the bfqq is scheduled to merge with another bfqq but the
+merge didn't happen yet, cancel the merge as it need not be valid
+anymore.
+
+CC: stable@vger.kernel.org
+Fixes: e21b7a0b9887 ("block, bfq: add full hierarchical scheduling and cgroups support")
+Tested-by: "yukuai (C)" <yukuai3@huawei.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Link: https://lore.kernel.org/r/20220401102752.8599-3-jack@suse.cz
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ block/bfq-cgroup.c  |   36 +++++++++++++++++++++++++++++++++---
+ block/bfq-iosched.c |    2 +-
+ block/bfq-iosched.h |    1 +
+ 3 files changed, 35 insertions(+), 4 deletions(-)
+
+--- a/block/bfq-cgroup.c
++++ b/block/bfq-cgroup.c
+@@ -725,9 +725,39 @@ static struct bfq_group *__bfq_bic_chang
+       }
+       if (sync_bfqq) {
+-              entity = &sync_bfqq->entity;
+-              if (entity->sched_data != &bfqg->sched_data)
+-                      bfq_bfqq_move(bfqd, sync_bfqq, bfqg);
++              if (!sync_bfqq->new_bfqq && !bfq_bfqq_coop(sync_bfqq)) {
++                      /* We are the only user of this bfqq, just move it */
++                      if (sync_bfqq->entity.sched_data != &bfqg->sched_data)
++                              bfq_bfqq_move(bfqd, sync_bfqq, bfqg);
++              } else {
++                      struct bfq_queue *bfqq;
++
++                      /*
++                       * The queue was merged to a different queue. Check
++                       * that the merge chain still belongs to the same
++                       * cgroup.
++                       */
++                      for (bfqq = sync_bfqq; bfqq; bfqq = bfqq->new_bfqq)
++                              if (bfqq->entity.sched_data !=
++                                  &bfqg->sched_data)
++                                      break;
++                      if (bfqq) {
++                              /*
++                               * Some queue changed cgroup so the merge is
++                               * not valid anymore. We cannot easily just
++                               * cancel the merge (by clearing new_bfqq) as
++                               * there may be other processes using this
++                               * queue and holding refs to all queues below
++                               * sync_bfqq->new_bfqq. Similarly if the merge
++                               * already happened, we need to detach from
++                               * bfqq now so that we cannot merge bio to a
++                               * request from the old cgroup.
++                               */
++                              bfq_put_cooperator(sync_bfqq);
++                              bfq_release_process_ref(bfqd, sync_bfqq);
++                              bic_set_bfqq(bic, NULL, 1);
++                      }
++              }
+       }
+       return bfqg;
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -4917,7 +4917,7 @@ void bfq_put_queue(struct bfq_queue *bfq
+       bfqg_and_blkg_put(bfqg);
+ }
+-static void bfq_put_cooperator(struct bfq_queue *bfqq)
++void bfq_put_cooperator(struct bfq_queue *bfqq)
+ {
+       struct bfq_queue *__bfqq, *next;
+--- a/block/bfq-iosched.h
++++ b/block/bfq-iosched.h
+@@ -954,6 +954,7 @@ void bfq_weights_tree_remove(struct bfq_
+ void bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq,
+                    bool compensate, enum bfqq_expiration reason);
+ void bfq_put_queue(struct bfq_queue *bfqq);
++void bfq_put_cooperator(struct bfq_queue *bfqq);
+ void bfq_end_wr_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg);
+ void bfq_release_process_ref(struct bfq_data *bfqd, struct bfq_queue *bfqq);
+ void bfq_schedule_dispatch(struct bfq_data *bfqd);
diff --git a/queue-5.10/bfq-track-whether-bfq_group-is-still-online.patch b/queue-5.10/bfq-track-whether-bfq_group-is-still-online.patch
new file mode 100644 (file)
index 0000000..064142d
--- /dev/null
@@ -0,0 +1,65 @@
+From 09f871868080c33992cd6a9b72a5ca49582578fa Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Fri, 1 Apr 2022 12:27:48 +0200
+Subject: bfq: Track whether bfq_group is still online
+
+From: Jan Kara <jack@suse.cz>
+
+commit 09f871868080c33992cd6a9b72a5ca49582578fa upstream.
+
+Track whether bfq_group is still online. We cannot rely on
+blkcg_gq->online because that gets cleared only after all policies are
+offlined and we need something that gets updated already under
+bfqd->lock when we are cleaning up our bfq_group to be able to guarantee
+that when we see online bfq_group, it will stay online while we are
+holding bfqd->lock lock.
+
+CC: stable@vger.kernel.org
+Tested-by: "yukuai (C)" <yukuai3@huawei.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Link: https://lore.kernel.org/r/20220401102752.8599-7-jack@suse.cz
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ block/bfq-cgroup.c  |    3 ++-
+ block/bfq-iosched.h |    2 ++
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+--- a/block/bfq-cgroup.c
++++ b/block/bfq-cgroup.c
+@@ -553,6 +553,7 @@ static void bfq_pd_init(struct blkg_poli
+                                  */
+       bfqg->bfqd = bfqd;
+       bfqg->active_entities = 0;
++      bfqg->online = true;
+       bfqg->rq_pos_tree = RB_ROOT;
+ }
+@@ -599,7 +600,6 @@ struct bfq_group *bfq_find_set_group(str
+       struct bfq_entity *entity;
+       bfqg = bfq_lookup_bfqg(bfqd, blkcg);
+-
+       if (unlikely(!bfqg))
+               return NULL;
+@@ -961,6 +961,7 @@ static void bfq_pd_offline(struct blkg_p
+ put_async_queues:
+       bfq_put_async_queues(bfqd, bfqg);
++      bfqg->online = false;
+       spin_unlock_irqrestore(&bfqd->lock, flags);
+       /*
+--- a/block/bfq-iosched.h
++++ b/block/bfq-iosched.h
+@@ -901,6 +901,8 @@ struct bfq_group {
+       /* reference counter (see comments in bfq_bic_update_cgroup) */
+       int ref;
++      /* Is bfq_group still online? */
++      bool online;
+       struct bfq_entity entity;
+       struct bfq_sched_data sched_data;
diff --git a/queue-5.10/bfq-update-cgroup-information-before-merging-bio.patch b/queue-5.10/bfq-update-cgroup-information-before-merging-bio.patch
new file mode 100644 (file)
index 0000000..75afd6c
--- /dev/null
@@ -0,0 +1,51 @@
+From ea591cd4eb270393810e7be01feb8fde6a34fbbe Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Fri, 1 Apr 2022 12:27:45 +0200
+Subject: bfq: Update cgroup information before merging bio
+
+From: Jan Kara <jack@suse.cz>
+
+commit ea591cd4eb270393810e7be01feb8fde6a34fbbe upstream.
+
+When the process is migrated to a different cgroup (or in case of
+writeback just starts submitting bios associated with a different
+cgroup) bfq_merge_bio() can operate with stale cgroup information in
+bic. Thus the bio can be merged to a request from a different cgroup or
+it can result in merging of bfqqs for different cgroups or bfqqs of
+already dead cgroups and causing possible use-after-free issues. Fix the
+problem by updating cgroup information in bfq_merge_bio().
+
+CC: stable@vger.kernel.org
+Fixes: e21b7a0b9887 ("block, bfq: add full hierarchical scheduling and cgroups support")
+Tested-by: "yukuai (C)" <yukuai3@huawei.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Link: https://lore.kernel.org/r/20220401102752.8599-4-jack@suse.cz
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ block/bfq-iosched.c |   11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -2227,10 +2227,17 @@ static bool bfq_bio_merge(struct request
+       spin_lock_irq(&bfqd->lock);
+-      if (bic)
++      if (bic) {
++              /*
++               * Make sure cgroup info is uptodate for current process before
++               * considering the merge.
++               */
++              bfq_bic_update_cgroup(bic, bio);
++
+               bfqd->bio_bfqq = bic_to_bfqq(bic, op_is_sync(bio->bi_opf));
+-      else
++      } else {
+               bfqd->bio_bfqq = NULL;
++      }
+       bfqd->bio_bic = bic;
+       ret = blk_mq_sched_try_merge(q, bio, nr_segs, &free);
diff --git a/queue-5.10/efi-do-not-import-certificates-from-uefi-secure-boot-for-t2-macs.patch b/queue-5.10/efi-do-not-import-certificates-from-uefi-secure-boot-for-t2-macs.patch
new file mode 100644 (file)
index 0000000..aec0ffc
--- /dev/null
@@ -0,0 +1,133 @@
+From 155ca952c7ca19aa32ecfb7373a32bbc2e1ec6eb Mon Sep 17 00:00:00 2001
+From: Aditya Garg <gargaditya08@live.com>
+Date: Fri, 15 Apr 2022 17:02:46 +0000
+Subject: efi: Do not import certificates from UEFI Secure Boot for T2 Macs
+
+From: Aditya Garg <gargaditya08@live.com>
+
+commit 155ca952c7ca19aa32ecfb7373a32bbc2e1ec6eb upstream.
+
+On Apple T2 Macs, when Linux attempts to read the db and dbx efi variables
+at early boot to load UEFI Secure Boot certificates, a page fault occurs
+in Apple firmware code and EFI runtime services are disabled with the
+following logs:
+
+[Firmware Bug]: Page fault caused by firmware at PA: 0xffffb1edc0068000
+WARNING: CPU: 3 PID: 104 at arch/x86/platform/efi/quirks.c:735 efi_crash_gracefully_on_page_fault+0x50/0xf0
+(Removed some logs from here)
+Call Trace:
+ <TASK>
+ page_fault_oops+0x4f/0x2c0
+ ? search_bpf_extables+0x6b/0x80
+ ? search_module_extables+0x50/0x80
+ ? search_exception_tables+0x5b/0x60
+ kernelmode_fixup_or_oops+0x9e/0x110
+ __bad_area_nosemaphore+0x155/0x190
+ bad_area_nosemaphore+0x16/0x20
+ do_kern_addr_fault+0x8c/0xa0
+ exc_page_fault+0xd8/0x180
+ asm_exc_page_fault+0x1e/0x30
+(Removed some logs from here)
+ ? __efi_call+0x28/0x30
+ ? switch_mm+0x20/0x30
+ ? efi_call_rts+0x19a/0x8e0
+ ? process_one_work+0x222/0x3f0
+ ? worker_thread+0x4a/0x3d0
+ ? kthread+0x17a/0x1a0
+ ? process_one_work+0x3f0/0x3f0
+ ? set_kthread_struct+0x40/0x40
+ ? ret_from_fork+0x22/0x30
+ </TASK>
+---[ end trace 1f82023595a5927f ]---
+efi: Froze efi_rts_wq and disabled EFI Runtime Services
+integrity: Couldn't get size: 0x8000000000000015
+integrity: MODSIGN: Couldn't get UEFI db list
+efi: EFI Runtime Services are disabled!
+integrity: Couldn't get size: 0x8000000000000015
+integrity: Couldn't get UEFI dbx list
+integrity: Couldn't get size: 0x8000000000000015
+integrity: Couldn't get mokx list
+integrity: Couldn't get size: 0x80000000
+
+So we avoid reading these UEFI variables and thus prevent the crash.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Aditya Garg <gargaditya08@live.com>
+Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
+Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ security/integrity/platform_certs/keyring_handler.h |    8 ++++
+ security/integrity/platform_certs/load_uefi.c       |   33 ++++++++++++++++++++
+ 2 files changed, 41 insertions(+)
+
+--- a/security/integrity/platform_certs/keyring_handler.h
++++ b/security/integrity/platform_certs/keyring_handler.h
+@@ -30,3 +30,11 @@ efi_element_handler_t get_handler_for_db
+ efi_element_handler_t get_handler_for_dbx(const efi_guid_t *sig_type);
+ #endif
++
++#ifndef UEFI_QUIRK_SKIP_CERT
++#define UEFI_QUIRK_SKIP_CERT(vendor, product) \
++               .matches = { \
++                      DMI_MATCH(DMI_BOARD_VENDOR, vendor), \
++                      DMI_MATCH(DMI_PRODUCT_NAME, product), \
++              },
++#endif
+--- a/security/integrity/platform_certs/load_uefi.c
++++ b/security/integrity/platform_certs/load_uefi.c
+@@ -3,6 +3,7 @@
+ #include <linux/kernel.h>
+ #include <linux/sched.h>
+ #include <linux/cred.h>
++#include <linux/dmi.h>
+ #include <linux/err.h>
+ #include <linux/efi.h>
+ #include <linux/slab.h>
+@@ -12,6 +13,31 @@
+ #include "keyring_handler.h"
+ /*
++ * On T2 Macs reading the db and dbx efi variables to load UEFI Secure Boot
++ * certificates causes occurrence of a page fault in Apple's firmware and
++ * a crash disabling EFI runtime services. The following quirk skips reading
++ * these variables.
++ */
++static const struct dmi_system_id uefi_skip_cert[] = {
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro15,1") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro15,2") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro15,3") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro15,4") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro16,1") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro16,2") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro16,3") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro16,4") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir8,1") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir8,2") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir9,1") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacMini8,1") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacPro7,1") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMac20,1") },
++      { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMac20,2") },
++      { }
++};
++
++/*
+  * Look to see if a UEFI variable called MokIgnoreDB exists and return true if
+  * it does.
+  *
+@@ -137,6 +163,13 @@ static int __init load_uefi_certs(void)
+       unsigned long dbsize = 0, dbxsize = 0, mokxsize = 0;
+       efi_status_t status;
+       int rc = 0;
++      const struct dmi_system_id *dmi_id;
++
++      dmi_id = dmi_first_match(uefi_skip_cert);
++      if (dmi_id) {
++              pr_err("Reading UEFI Secure Boot Certs is not supported on T2 Macs.\n");
++              return false;
++      }
+       if (!efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE))
+               return false;
diff --git a/queue-5.10/fs-writeback-writeback_sb_inodes-recalculate-wrote-according-skipped-pages.patch b/queue-5.10/fs-writeback-writeback_sb_inodes-recalculate-wrote-according-skipped-pages.patch
new file mode 100644 (file)
index 0000000..1da6156
--- /dev/null
@@ -0,0 +1,154 @@
+From 68f4c6eba70df70a720188bce95c85570ddfcc87 Mon Sep 17 00:00:00 2001
+From: Zhihao Cheng <chengzhihao1@huawei.com>
+Date: Tue, 10 May 2022 21:38:05 +0800
+Subject: fs-writeback: writeback_sb_inodes:Recalculate 'wrote' according skipped pages
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Zhihao Cheng <chengzhihao1@huawei.com>
+
+commit 68f4c6eba70df70a720188bce95c85570ddfcc87 upstream.
+
+Commit 505a666ee3fc ("writeback: plug writeback in wb_writeback() and
+writeback_inodes_wb()") has us holding a plug during wb_writeback, which
+may cause a potential ABBA dead lock:
+
+    wb_writeback               fat_file_fsync
+blk_start_plug(&plug)
+for (;;) {
+  iter i-1: some reqs have been added into plug->mq_list  // LOCK A
+  iter i:
+    progress = __writeback_inodes_wb(wb, work)
+    . writeback_sb_inodes // fat's bdev
+    .   __writeback_single_inode
+    .   . generic_writepages
+    .   .   __block_write_full_page
+    .   .   . .            __generic_file_fsync
+    .   .   . .              sync_inode_metadata
+    .   .   . .                writeback_single_inode
+    .   .   . .                  __writeback_single_inode
+    .   .   . .                    fat_write_inode
+    .   .   . .                      __fat_write_inode
+    .   .   . .                        sync_dirty_buffer       // fat's bdev
+    .   .   . .                          lock_buffer(bh)       // LOCK B
+    .   .   . .                            submit_bh
+    .   .   . .                              blk_mq_get_tag    // LOCK A
+    .   .   . trylock_buffer(bh)  // LOCK B
+    .   .   .   redirty_page_for_writepage
+    .   .   .     wbc->pages_skipped++
+    .   .   --wbc->nr_to_write
+    .   wrote += write_chunk - wbc.nr_to_write  // wrote > 0
+    .   requeue_inode
+    .     redirty_tail_locked
+    if (progress)    // progress > 0
+      continue;
+  iter i+1:
+      queue_io
+      // similar process with iter i, infinite for-loop !
+}
+blk_finish_plug(&plug)   // flush plug won't be called
+
+Above process triggers a hungtask like:
+[  399.044861] INFO: task bb:2607 blocked for more than 30 seconds.
+[  399.046824]       Not tainted 5.18.0-rc1-00005-gefae4d9eb6a2-dirty
+[  399.051539] task:bb              state:D stack:    0 pid: 2607 ppid:
+2426 flags:0x00004000
+[  399.051556] Call Trace:
+[  399.051570]  __schedule+0x480/0x1050
+[  399.051592]  schedule+0x92/0x1a0
+[  399.051602]  io_schedule+0x22/0x50
+[  399.051613]  blk_mq_get_tag+0x1d3/0x3c0
+[  399.051640]  __blk_mq_alloc_requests+0x21d/0x3f0
+[  399.051657]  blk_mq_submit_bio+0x68d/0xca0
+[  399.051674]  __submit_bio+0x1b5/0x2d0
+[  399.051708]  submit_bio_noacct+0x34e/0x720
+[  399.051718]  submit_bio+0x3b/0x150
+[  399.051725]  submit_bh_wbc+0x161/0x230
+[  399.051734]  __sync_dirty_buffer+0xd1/0x420
+[  399.051744]  sync_dirty_buffer+0x17/0x20
+[  399.051750]  __fat_write_inode+0x289/0x310
+[  399.051766]  fat_write_inode+0x2a/0xa0
+[  399.051783]  __writeback_single_inode+0x53c/0x6f0
+[  399.051795]  writeback_single_inode+0x145/0x200
+[  399.051803]  sync_inode_metadata+0x45/0x70
+[  399.051856]  __generic_file_fsync+0xa3/0x150
+[  399.051880]  fat_file_fsync+0x1d/0x80
+[  399.051895]  vfs_fsync_range+0x40/0xb0
+[  399.051929]  __x64_sys_fsync+0x18/0x30
+
+In my test, 'need_resched()' (which is imported by 590dca3a71 "fs-writeback:
+unplug before cond_resched in writeback_sb_inodes") in function
+'writeback_sb_inodes()' seldom comes true, unless cond_resched() is deleted
+from write_cache_pages().
+
+Fix it by correcting wrote number according number of skipped pages
+in writeback_sb_inodes().
+
+Goto Link to find a reproducer.
+
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=215837
+Cc: stable@vger.kernel.org # v4.3
+Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
+Reviewed-by: Jan Kara <jack@suse.cz>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Link: https://lore.kernel.org/r/20220510133805.1988292-1-chengzhihao1@huawei.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/fs-writeback.c |   13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/fs/fs-writeback.c
++++ b/fs/fs-writeback.c
+@@ -1650,11 +1650,12 @@ static long writeback_sb_inodes(struct s
+       };
+       unsigned long start_time = jiffies;
+       long write_chunk;
+-      long wrote = 0;  /* count both pages and inodes */
++      long total_wrote = 0;  /* count both pages and inodes */
+       while (!list_empty(&wb->b_io)) {
+               struct inode *inode = wb_inode(wb->b_io.prev);
+               struct bdi_writeback *tmp_wb;
++              long wrote;
+               if (inode->i_sb != sb) {
+                       if (work->sb) {
+@@ -1730,7 +1731,9 @@ static long writeback_sb_inodes(struct s
+               wbc_detach_inode(&wbc);
+               work->nr_pages -= write_chunk - wbc.nr_to_write;
+-              wrote += write_chunk - wbc.nr_to_write;
++              wrote = write_chunk - wbc.nr_to_write - wbc.pages_skipped;
++              wrote = wrote < 0 ? 0 : wrote;
++              total_wrote += wrote;
+               if (need_resched()) {
+                       /*
+@@ -1752,7 +1755,7 @@ static long writeback_sb_inodes(struct s
+               tmp_wb = inode_to_wb_and_lock_list(inode);
+               spin_lock(&inode->i_lock);
+               if (!(inode->i_state & I_DIRTY_ALL))
+-                      wrote++;
++                      total_wrote++;
+               requeue_inode(inode, tmp_wb, &wbc);
+               inode_sync_complete(inode);
+               spin_unlock(&inode->i_lock);
+@@ -1766,14 +1769,14 @@ static long writeback_sb_inodes(struct s
+                * bail out to wb_writeback() often enough to check
+                * background threshold and other termination conditions.
+                */
+-              if (wrote) {
++              if (total_wrote) {
+                       if (time_is_before_jiffies(start_time + HZ / 10UL))
+                               break;
+                       if (work->nr_pages <= 0)
+                               break;
+               }
+       }
+-      return wrote;
++      return total_wrote;
+ }
+ static long __writeback_inodes_wb(struct bdi_writeback *wb,
index 146665484c81817ce2c3e15c0a3957bb0a5f26fc..1e93399135813e6b961853d878d1687ab99fcdea 100644 (file)
@@ -351,3 +351,8 @@ f2fs-fix-fallocate-to-use-file_modified-to-update-permissions-consistently.patch
 f2fs-fix-to-do-sanity-check-for-inline-inode.patch
 wifi-mac80211-fix-use-after-free-in-chanctx-code.patch
 iwlwifi-mvm-fix-assert-1f04-upon-reconfig.patch
+fs-writeback-writeback_sb_inodes-recalculate-wrote-according-skipped-pages.patch
+efi-do-not-import-certificates-from-uefi-secure-boot-for-t2-macs.patch
+bfq-split-shared-queues-on-move-between-cgroups.patch
+bfq-update-cgroup-information-before-merging-bio.patch
+bfq-track-whether-bfq_group-is-still-online.patch