From: Greg Kroah-Hartman Date: Tue, 14 Apr 2020 17:42:51 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.19.116~59 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5b9ba86c97d0c77d1f77252865348d029c5877fe;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: erofs-correct-the-remaining-shrink-objects.patch io_uring-honor-original-task-rlimit_fsize.patch --- diff --git a/queue-5.4/erofs-correct-the-remaining-shrink-objects.patch b/queue-5.4/erofs-correct-the-remaining-shrink-objects.patch new file mode 100644 index 00000000000..7aaef463b84 --- /dev/null +++ b/queue-5.4/erofs-correct-the-remaining-shrink-objects.patch @@ -0,0 +1,35 @@ +From 9d5a09c6f3b5fb85af20e3a34827b5d27d152b34 Mon Sep 17 00:00:00 2001 +From: Gao Xiang +Date: Wed, 26 Feb 2020 16:10:06 +0800 +Subject: erofs: correct the remaining shrink objects + +From: Gao Xiang + +commit 9d5a09c6f3b5fb85af20e3a34827b5d27d152b34 upstream. + +The remaining count should not include successful +shrink attempts. + +Fixes: e7e9a307be9d ("staging: erofs: introduce workstation for decompression") +Cc: # 4.19+ +Link: https://lore.kernel.org/r/20200226081008.86348-1-gaoxiang25@huawei.com +Reviewed-by: Chao Yu +Signed-off-by: Gao Xiang +Signed-off-by: Greg Kroah-Hartman + + +--- + fs/erofs/utils.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/erofs/utils.c ++++ b/fs/erofs/utils.c +@@ -294,7 +294,7 @@ static unsigned long erofs_shrink_scan(s + spin_unlock(&erofs_sb_list_lock); + sbi->shrinker_run_no = run_no; + +- freed += erofs_shrink_workstation(sbi, nr, false); ++ freed += erofs_shrink_workstation(sbi, nr - freed, false); + + spin_lock(&erofs_sb_list_lock); + /* Get the next list element before we move this one */ diff --git a/queue-5.4/io_uring-honor-original-task-rlimit_fsize.patch b/queue-5.4/io_uring-honor-original-task-rlimit_fsize.patch new file mode 100644 index 00000000000..bf5775f7ad6 --- /dev/null +++ b/queue-5.4/io_uring-honor-original-task-rlimit_fsize.patch @@ -0,0 +1,64 @@ +From 4ed734b0d0913e566a9d871e15d24eb240f269f7 Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Fri, 20 Mar 2020 11:23:41 -0600 +Subject: io_uring: honor original task RLIMIT_FSIZE + +From: Jens Axboe + +commit 4ed734b0d0913e566a9d871e15d24eb240f269f7 upstream. + +With the previous fixes for number of files open checking, I added some +debug code to see if we had other spots where we're checking rlimit() +against the async io-wq workers. The only one I found was file size +checking, which we should also honor. + +During write and fallocate prep, store the max file size and override +that for the current ask if we're in io-wq worker context. + +Cc: stable@vger.kernel.org # 5.1+ +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman + + +--- + fs/io_uring.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -331,6 +331,7 @@ struct io_kiocb { + #define REQ_F_ISREG 2048 /* regular file */ + #define REQ_F_MUST_PUNT 4096 /* must be punted even for NONBLOCK */ + #define REQ_F_TIMEOUT_NOSEQ 8192 /* no timeout sequence */ ++ unsigned long fsize; + u64 user_data; + u32 result; + u32 sequence; +@@ -1085,6 +1086,9 @@ static int io_prep_rw(struct io_kiocb *r + if (S_ISREG(file_inode(req->file)->i_mode)) + req->flags |= REQ_F_ISREG; + ++ if (force_nonblock) ++ req->fsize = rlimit(RLIMIT_FSIZE); ++ + /* + * If the file doesn't support async, mark it as REQ_F_MUST_PUNT so + * we know to async punt it even if it was opened O_NONBLOCK +@@ -1504,10 +1508,17 @@ static int io_write(struct io_kiocb *req + } + kiocb->ki_flags |= IOCB_WRITE; + ++ if (!force_nonblock) ++ current->signal->rlim[RLIMIT_FSIZE].rlim_cur = req->fsize; ++ + if (file->f_op->write_iter) + ret2 = call_write_iter(file, kiocb, &iter); + else + ret2 = loop_rw_iter(WRITE, file, kiocb, &iter); ++ ++ if (!force_nonblock) ++ current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; ++ + if (!force_nonblock || ret2 != -EAGAIN) { + io_rw_done(kiocb, ret2); + } else { diff --git a/queue-5.4/series b/queue-5.4/series index a5f97957f1b..d1a89ab8fb2 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -149,3 +149,5 @@ remoteproc-qcom_q6v5_mss-reload-the-mba-region-on-coredump.patch remoteproc-fix-null-pointer-dereference-in-rproc_virtio_notify.patch crypto-rng-fix-a-refcounting-bug-in-crypto_rng_reset.patch crypto-mxs-dcp-fix-scatterlist-linearization-for-hash.patch +erofs-correct-the-remaining-shrink-objects.patch +io_uring-honor-original-task-rlimit_fsize.patch