]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jun 2022 13:08:01 +0000 (15:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jun 2022 13:08:01 +0000 (15:08 +0200)
added patches:
nfsd-replace-use-of-rwsem-with-errseq_t.patch
revert-drm-amd-display-fix-dcn3-b0-dp-alt-mapping.patch

queue-5.15/nfsd-replace-use-of-rwsem-with-errseq_t.patch [new file with mode: 0644]
queue-5.15/revert-drm-amd-display-fix-dcn3-b0-dp-alt-mapping.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/nfsd-replace-use-of-rwsem-with-errseq_t.patch b/queue-5.15/nfsd-replace-use-of-rwsem-with-errseq_t.patch
new file mode 100644 (file)
index 0000000..ce85715
--- /dev/null
@@ -0,0 +1,217 @@
+From 555dbf1a9aac6d3150c8b52fa35f768a692f4eeb Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+Date: Sat, 18 Dec 2021 20:38:01 -0500
+Subject: nfsd: Replace use of rwsem with errseq_t
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+commit 555dbf1a9aac6d3150c8b52fa35f768a692f4eeb upstream.
+
+The nfsd_file nf_rwsem is currently being used to separate file write
+and commit instances to ensure that we catch errors and apply them to
+the correct write/commit.
+We can improve scalability at the expense of a little accuracy (some
+extra false positives) by replacing the nf_rwsem with more careful
+use of the errseq_t mechanism to track errors across the different
+operations.
+
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+[ cel: rebased on zero-verifier fix ]
+Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfsd/filecache.c |    1 -
+ fs/nfsd/filecache.h |    1 -
+ fs/nfsd/nfs4proc.c  |   16 +++++++++-------
+ fs/nfsd/vfs.c       |   40 +++++++++++++++-------------------------
+ 4 files changed, 24 insertions(+), 34 deletions(-)
+
+--- a/fs/nfsd/filecache.c
++++ b/fs/nfsd/filecache.c
+@@ -194,7 +194,6 @@ nfsd_file_alloc(struct inode *inode, uns
+                               __set_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags);
+               }
+               nf->nf_mark = NULL;
+-              init_rwsem(&nf->nf_rwsem);
+               trace_nfsd_file_alloc(nf);
+       }
+       return nf;
+--- a/fs/nfsd/filecache.h
++++ b/fs/nfsd/filecache.h
+@@ -46,7 +46,6 @@ struct nfsd_file {
+       refcount_t              nf_ref;
+       unsigned char           nf_may;
+       struct nfsd_file_mark   *nf_mark;
+-      struct rw_semaphore     nf_rwsem;
+ };
+ int nfsd_file_cache_init(void);
+--- a/fs/nfsd/nfs4proc.c
++++ b/fs/nfsd/nfs4proc.c
+@@ -1515,6 +1515,9 @@ static void nfsd4_init_copy_res(struct n
+ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy)
+ {
++      struct file *dst = copy->nf_dst->nf_file;
++      struct file *src = copy->nf_src->nf_file;
++      errseq_t since;
+       ssize_t bytes_copied = 0;
+       u64 bytes_total = copy->cp_count;
+       u64 src_pos = copy->cp_src_pos;
+@@ -1527,9 +1530,8 @@ static ssize_t _nfsd_copy_file_range(str
+       do {
+               if (kthread_should_stop())
+                       break;
+-              bytes_copied = nfsd_copy_file_range(copy->nf_src->nf_file,
+-                              src_pos, copy->nf_dst->nf_file, dst_pos,
+-                              bytes_total);
++              bytes_copied = nfsd_copy_file_range(src, src_pos, dst, dst_pos,
++                                                  bytes_total);
+               if (bytes_copied <= 0)
+                       break;
+               bytes_total -= bytes_copied;
+@@ -1539,11 +1541,11 @@ static ssize_t _nfsd_copy_file_range(str
+       } while (bytes_total > 0 && !copy->cp_synchronous);
+       /* for a non-zero asynchronous copy do a commit of data */
+       if (!copy->cp_synchronous && copy->cp_res.wr_bytes_written > 0) {
+-              down_write(&copy->nf_dst->nf_rwsem);
+-              status = vfs_fsync_range(copy->nf_dst->nf_file,
+-                                       copy->cp_dst_pos,
++              since = READ_ONCE(dst->f_wb_err);
++              status = vfs_fsync_range(dst, copy->cp_dst_pos,
+                                        copy->cp_res.wr_bytes_written, 0);
+-              up_write(&copy->nf_dst->nf_rwsem);
++              if (!status)
++                      status = filemap_check_wb_err(dst->f_mapping, since);
+               if (!status)
+                       copy->committed = true;
+       }
+--- a/fs/nfsd/vfs.c
++++ b/fs/nfsd/vfs.c
+@@ -525,10 +525,11 @@ __be32 nfsd4_clone_file_range(struct nfs
+ {
+       struct file *src = nf_src->nf_file;
+       struct file *dst = nf_dst->nf_file;
++      errseq_t since;
+       loff_t cloned;
+       __be32 ret = 0;
+-      down_write(&nf_dst->nf_rwsem);
++      since = READ_ONCE(dst->f_wb_err);
+       cloned = vfs_clone_file_range(src, src_pos, dst, dst_pos, count, 0);
+       if (cloned < 0) {
+               ret = nfserrno(cloned);
+@@ -543,6 +544,8 @@ __be32 nfsd4_clone_file_range(struct nfs
+               int status = vfs_fsync_range(dst, dst_pos, dst_end, 0);
+               if (!status)
++                      status = filemap_check_wb_err(dst->f_mapping, since);
++              if (!status)
+                       status = commit_inode_metadata(file_inode(src));
+               if (status < 0) {
+                       nfsd_reset_boot_verifier(net_generic(nf_dst->nf_net,
+@@ -551,7 +554,6 @@ __be32 nfsd4_clone_file_range(struct nfs
+               }
+       }
+ out_err:
+-      up_write(&nf_dst->nf_rwsem);
+       return ret;
+ }
+@@ -954,6 +956,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
+       struct super_block      *sb = file_inode(file)->i_sb;
+       struct svc_export       *exp;
+       struct iov_iter         iter;
++      errseq_t                since;
+       __be32                  nfserr;
+       int                     host_err;
+       int                     use_wgather;
+@@ -991,8 +994,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
+               flags |= RWF_SYNC;
+       iov_iter_kvec(&iter, WRITE, vec, vlen, *cnt);
++      since = READ_ONCE(file->f_wb_err);
+       if (flags & RWF_SYNC) {
+-              down_write(&nf->nf_rwsem);
+               if (verf)
+                       nfsd_copy_boot_verifier(verf,
+                                       net_generic(SVC_NET(rqstp),
+@@ -1001,15 +1004,12 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
+               if (host_err < 0)
+                       nfsd_reset_boot_verifier(net_generic(SVC_NET(rqstp),
+                                                nfsd_net_id));
+-              up_write(&nf->nf_rwsem);
+       } else {
+-              down_read(&nf->nf_rwsem);
+               if (verf)
+                       nfsd_copy_boot_verifier(verf,
+                                       net_generic(SVC_NET(rqstp),
+                                       nfsd_net_id));
+               host_err = vfs_iter_write(file, &iter, &pos, flags);
+-              up_read(&nf->nf_rwsem);
+       }
+       if (host_err < 0) {
+               nfsd_reset_boot_verifier(net_generic(SVC_NET(rqstp),
+@@ -1019,6 +1019,9 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
+       *cnt = host_err;
+       nfsd_stats_io_write_add(exp, *cnt);
+       fsnotify_modify(file);
++      host_err = filemap_check_wb_err(file->f_mapping, since);
++      if (host_err < 0)
++              goto out_nfserr;
+       if (stable && use_wgather) {
+               host_err = wait_for_concurrent_writes(file);
+@@ -1099,19 +1102,6 @@ out:
+ }
+ #ifdef CONFIG_NFSD_V3
+-static int
+-nfsd_filemap_write_and_wait_range(struct nfsd_file *nf, loff_t offset,
+-                                loff_t end)
+-{
+-      struct address_space *mapping = nf->nf_file->f_mapping;
+-      int ret = filemap_fdatawrite_range(mapping, offset, end);
+-
+-      if (ret)
+-              return ret;
+-      filemap_fdatawait_range_keep_errors(mapping, offset, end);
+-      return 0;
+-}
+-
+ /*
+  * Commit all pending writes to stable storage.
+  *
+@@ -1142,25 +1132,25 @@ nfsd_commit(struct svc_rqst *rqstp, stru
+       if (err)
+               goto out;
+       if (EX_ISSYNC(fhp->fh_export)) {
+-              int err2 = nfsd_filemap_write_and_wait_range(nf, offset, end);
++              errseq_t since = READ_ONCE(nf->nf_file->f_wb_err);
++              int err2;
+-              down_write(&nf->nf_rwsem);
+-              if (!err2)
+-                      err2 = vfs_fsync_range(nf->nf_file, offset, end, 0);
++              err2 = vfs_fsync_range(nf->nf_file, offset, end, 0);
+               switch (err2) {
+               case 0:
+                       nfsd_copy_boot_verifier(verf, net_generic(nf->nf_net,
+                                               nfsd_net_id));
++                      err2 = filemap_check_wb_err(nf->nf_file->f_mapping,
++                                                  since);
+                       break;
+               case -EINVAL:
+                       err = nfserr_notsupp;
+                       break;
+               default:
+-                      err = nfserrno(err2);
+                       nfsd_reset_boot_verifier(net_generic(nf->nf_net,
+                                                nfsd_net_id));
+               }
+-              up_write(&nf->nf_rwsem);
++              err = nfserrno(err2);
+       } else
+               nfsd_copy_boot_verifier(verf, net_generic(nf->nf_net,
+                                       nfsd_net_id));
diff --git a/queue-5.15/revert-drm-amd-display-fix-dcn3-b0-dp-alt-mapping.patch b/queue-5.15/revert-drm-amd-display-fix-dcn3-b0-dp-alt-mapping.patch
new file mode 100644 (file)
index 0000000..860a3c2
--- /dev/null
@@ -0,0 +1,41 @@
+From 1039188806d4cfdf9c412bb4ddb51b4d8cd15478 Mon Sep 17 00:00:00 2001
+From: Stylon Wang <stylon.wang@amd.com>
+Date: Wed, 4 May 2022 18:09:44 +0800
+Subject: Revert "drm/amd/display: Fix DCN3 B0 DP Alt Mapping"
+
+From: Stylon Wang <stylon.wang@amd.com>
+
+commit 1039188806d4cfdf9c412bb4ddb51b4d8cd15478 upstream.
+
+This reverts commit 4b7786d87fb3adf3e534c4f1e4f824d8700b786b.
+
+Commit 4b7786d87fb3 ("drm/amd/display: Fix DCN3 B0 DP Alt Mapping")
+is causing 2nd USB-C display not lighting up.
+Phy id remapping is done differently than is assumed in this
+patch.
+
+Signed-off-by: Stylon Wang <stylon.wang@amd.com>
+Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: "Limonciello, Mario" <Mario.Limonciello@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c |    6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c
++++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c
+@@ -1294,12 +1294,6 @@ static struct stream_encoder *dcn31_stre
+       if (!enc1 || !vpg || !afmt)
+               return NULL;
+-      if (ctx->asic_id.chip_family == FAMILY_YELLOW_CARP &&
+-                      ctx->asic_id.hw_internal_rev == YELLOW_CARP_B0) {
+-              if ((eng_id == ENGINE_ID_DIGC) || (eng_id == ENGINE_ID_DIGD))
+-                      eng_id = eng_id + 3; // For B0 only. C->F, D->G.
+-      }
+-
+       dcn30_dio_stream_encoder_construct(enc1, ctx, ctx->dc_bios,
+                                       eng_id, vpg, afmt,
+                                       &stream_enc_regs[eng_id],
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a1c85a390f9d4e5163c2b505e8da9adcf3caebd3 100644 (file)
@@ -0,0 +1,2 @@
+revert-drm-amd-display-fix-dcn3-b0-dp-alt-mapping.patch
+nfsd-replace-use-of-rwsem-with-errseq_t.patch