From 9babe4e6c2e276ff49b1052c26447336f2ba38a9 Mon Sep 17 00:00:00 2001 From: Denis Kirjanov Date: Apr 05 2022 07:26:25 +0000 Subject: Merge branch 'users/nfbrown/SLE12-SP5/for-next' into SLE12-SP5 Pull NFS fixes and blacklist update from Neil Brown --- diff --git a/blacklist.conf b/blacklist.conf index d9ba1c2..e1df361 100644 --- a/blacklist.conf +++ b/blacklist.conf @@ -2106,3 +2106,5 @@ ff0e50d3564f33b7f4b35cadeabd951d66cfc570 # known to cause regressions 21b5fcdccb32ff09b6b63d4a83c037150665a83f # no gadget mode in SLE12 63c4c320ccf77074ffe9019ac596603133c1b517 # no gadget mode in SLE12 123086843372bc93d26f52edfb71dbf951cd2f17 # # requires USB PD 3.0 +6c984083ec2453dfd3fcf98f392f34500c73e3f2 # not needed +cb8fac6d2727f79f211e745b16c9abbf4d8be652 # cosmetic diff --git a/patches.suse/NFS-Return-valid-errors-from-nfs2-3_decode_dirent.patch b/patches.suse/NFS-Return-valid-errors-from-nfs2-3_decode_dirent.patch new file mode 100644 index 0000000..d7f1183 --- /dev/null +++ b/patches.suse/NFS-Return-valid-errors-from-nfs2-3_decode_dirent.patch @@ -0,0 +1,98 @@ +From: Trond Myklebust +Date: Thu, 24 Feb 2022 10:59:37 -0500 +Subject: [PATCH] NFS: Return valid errors from nfs2/3_decode_dirent() +Git-commit: 64cfca85bacde54caa64e0ab855c48734894fa37 +Patch-mainline: v5.18 +References: git-fixes + +Valid return values for decode_dirent() callback functions are: + 0: Success + -EBADCOOKIE: End of directory + -EAGAIN: End of xdr_stream + +All errors need to map into one of those three values. + +Fixes: 573c4e1ef53a ("NFS: Simplify ->decode_dirent() calling sequence") +Signed-off-by: Trond Myklebust +Acked-by: NeilBrown + +--- + fs/nfs/nfs2xdr.c | 2 +- + fs/nfs/nfs3xdr.c | 20 ++++++-------------- + 2 files changed, 7 insertions(+), 15 deletions(-) + +--- a/fs/nfs/nfs2xdr.c ++++ b/fs/nfs/nfs2xdr.c +@@ -938,7 +938,7 @@ int nfs2_decode_dirent(struct xdr_stream + + error = decode_filename_inline(xdr, &entry->name, &entry->len); + if (unlikely(error)) +- return error; ++ return -EAGAIN; + + /* + * The type (size and byte order) of nfscookie isn't defined in +--- a/fs/nfs/nfs3xdr.c ++++ b/fs/nfs/nfs3xdr.c +@@ -1948,7 +1948,6 @@ out_status: + int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, + int plus) + { +- struct nfs_entry old = *entry; + __be32 *p; + int error; + +@@ -1967,16 +1966,16 @@ int nfs3_decode_dirent(struct xdr_stream + + error = decode_fileid3(xdr, &entry->ino); + if (unlikely(error)) +- return error; ++ return -EAGAIN; + + error = decode_inline_filename3(xdr, &entry->name, &entry->len); + if (unlikely(error)) +- return error; ++ return -EAGAIN; + + entry->prev_cookie = entry->cookie; + error = decode_cookie3(xdr, &entry->cookie); + if (unlikely(error)) +- return error; ++ return -EAGAIN; + + entry->d_type = DT_UNKNOWN; + +@@ -1984,7 +1983,7 @@ int nfs3_decode_dirent(struct xdr_stream + entry->fattr->valid = 0; + error = decode_post_op_attr(xdr, entry->fattr); + if (unlikely(error)) +- return error; ++ return -EAGAIN; + if (entry->fattr->valid & NFS_ATTR_FATTR_V3) + entry->d_type = nfs_umode_to_dtype(entry->fattr->mode); + +@@ -1999,11 +1998,8 @@ int nfs3_decode_dirent(struct xdr_stream + goto out_overflow; + if (*p != xdr_zero) { + error = decode_nfs_fh3(xdr, entry->fh); +- if (unlikely(error)) { +- if (error == -E2BIG) +- goto out_truncated; +- return error; +- } ++ if (unlikely(error)) ++ return -EAGAIN; + } else + zero_nfs_fh3(entry->fh); + } +@@ -2013,10 +2009,6 @@ int nfs3_decode_dirent(struct xdr_stream + out_overflow: + print_overflow_msg(__func__, xdr); + return -EAGAIN; +-out_truncated: +- dprintk("NFS: directory entry contains invalid file handle\n"); +- *entry = old; +- return -EAGAIN; + } + + /* diff --git a/patches.suse/NFSv4-pNFS-Fix-another-issue-with-a-list-iterator-po.patch b/patches.suse/NFSv4-pNFS-Fix-another-issue-with-a-list-iterator-po.patch new file mode 100644 index 0000000..20d3447 --- /dev/null +++ b/patches.suse/NFSv4-pNFS-Fix-another-issue-with-a-list-iterator-po.patch @@ -0,0 +1,109 @@ +From: Trond Myklebust +Date: Mon, 28 Mar 2022 08:36:34 -0400 +Subject: [PATCH] NFSv4/pNFS: Fix another issue with a list iterator pointing + to the head +Git-commit: 7c9d845f0612e5bcd23456a2ec43be8ac43458f1 +Patch-mainline: v5.18 +References: git-fixes + +In nfs4_callback_devicenotify(), if we don't find a matching entry for +the deviceid, we're left with a pointer to 'struct nfs_server' that +actually points to the list of super blocks associated with our struct +nfs_client. +Furthermore, even if we have a valid pointer, nothing pins the super +block, and so the struct nfs_server could end up getting freed while +we're using it. + +Since all we want is a pointer to the struct pnfs_layoutdriver_type, +let's skip all the iteration over super blocks, and just use APIs to +find the layout driver directly. + +Reported-by: Xiaomeng Tong +Fixes: 1be5683b03a7 ("pnfs: CB_NOTIFY_DEVICEID") +Signed-off-by: Trond Myklebust +Acked-by: NeilBrown + +--- + fs/nfs/callback_proc.c | 27 +++++++++------------------ + fs/nfs/pnfs.c | 11 +++++++++++ + fs/nfs/pnfs.h | 2 ++ + 3 files changed, 22 insertions(+), 18 deletions(-) + +--- a/fs/nfs/callback_proc.c ++++ b/fs/nfs/callback_proc.c +@@ -351,11 +351,10 @@ __be32 nfs4_callback_devicenotify(struct + void *dummy, struct cb_process_state *cps) + { + int i; ++ const struct pnfs_layoutdriver_type *ld = NULL; + __be32 res = 0; +- struct nfs_client *clp = cps->clp; +- struct nfs_server *server = NULL; + +- if (!clp) { ++ if (!cps->clp) { + res = cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION); + goto out; + } +@@ -363,23 +362,15 @@ __be32 nfs4_callback_devicenotify(struct + for (i = 0; i < args->ndevs; i++) { + struct cb_devicenotifyitem *dev = &args->devs[i]; + +- if (!server || +- server->pnfs_curr_ld->id != dev->cbd_layout_type) { +- rcu_read_lock(); +- list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) +- if (server->pnfs_curr_ld && +- server->pnfs_curr_ld->id == dev->cbd_layout_type) { +- rcu_read_unlock(); +- goto found; +- } +- rcu_read_unlock(); +- continue; ++ if (!ld || ld->id != dev->cbd_layout_type) { ++ pnfs_put_layoutdriver(ld); ++ ld = pnfs_find_layoutdriver(dev->cbd_layout_type); ++ if (!ld) ++ continue; + } +- +- found: +- nfs4_delete_deviceid(server->pnfs_curr_ld, clp, &dev->cbd_dev_id); ++ nfs4_delete_deviceid(ld, cps->clp, &dev->cbd_dev_id); + } +- ++ pnfs_put_layoutdriver(ld); + out: + kfree(args->devs); + return res; +--- a/fs/nfs/pnfs.c ++++ b/fs/nfs/pnfs.c +@@ -91,6 +91,17 @@ find_pnfs_driver(u32 id) + return local; + } + ++const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver(u32 id) ++{ ++ return find_pnfs_driver(id); ++} ++ ++void pnfs_put_layoutdriver(const struct pnfs_layoutdriver_type *ld) ++{ ++ if (ld) ++ module_put(ld->owner); ++} ++ + void + unset_pnfs_layoutdriver(struct nfs_server *nfss) + { +--- a/fs/nfs/pnfs.h ++++ b/fs/nfs/pnfs.h +@@ -220,6 +220,8 @@ struct pnfs_devicelist { + + extern int pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *); + extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *); ++extern const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver(u32 id); ++extern void pnfs_put_layoutdriver(const struct pnfs_layoutdriver_type *ld); + + /* nfs4proc.c */ + extern int nfs4_proc_getdeviceinfo(struct nfs_server *server, diff --git a/patches.suse/NFSv4.1-don-t-retry-BIND_CONN_TO_SESSION-on-session-.patch b/patches.suse/NFSv4.1-don-t-retry-BIND_CONN_TO_SESSION-on-session-.patch new file mode 100644 index 0000000..73f747b --- /dev/null +++ b/patches.suse/NFSv4.1-don-t-retry-BIND_CONN_TO_SESSION-on-session-.patch @@ -0,0 +1,40 @@ +From: Olga Kornievskaia +Date: Thu, 24 Mar 2022 10:38:42 -0400 +Subject: [PATCH] NFSv4.1: don't retry BIND_CONN_TO_SESSION on session error +Git-commit: 1d15d121cc2ad4d016a7dc1493132a9696f91fc5 +Patch-mainline: v5.18 +References: git-fixes + +There is no reason to retry the operation if a session error had +occurred in such case result structure isn't filled out. + +Fixes: dff58530c4ca ("NFSv4.1: fix handling of backchannel binding in BIND_CONN_TO_SESSION") +Signed-off-by: Olga Kornievskaia +Signed-off-by: Trond Myklebust +Acked-by: NeilBrown + +--- + fs/nfs/nfs4proc.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -7368,6 +7368,9 @@ nfs4_bind_one_conn_to_session_done(struc + struct nfs41_bind_conn_to_session_args *args = task->tk_msg.rpc_argp; + struct nfs41_bind_conn_to_session_res *res = task->tk_msg.rpc_resp; + ++ if (task->tk_status == -NFS4ERR_DEADSESSION) ++ return; ++ + if (args->dir == NFS4_CDFC4_FORE_OR_BOTH && + res->dir != NFS4_CDFS4_BOTH) { + rpc_task_close_connection(task); +@@ -7377,7 +7380,7 @@ nfs4_bind_one_conn_to_session_done(struc + } + + static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { +- .rpc_call_done = &nfs4_bind_one_conn_to_session_done, ++ .rpc_call_done = nfs4_bind_one_conn_to_session_done, + }; + + /* diff --git a/series.conf b/series.conf index f73fb0a..36062f1 100644 --- a/series.conf +++ b/series.conf @@ -60980,6 +60980,9 @@ patches.suse/powerpc-tm-Fix-more-userspace-r13-corruption.patch patches.suse/powerpc-pseries-Fix-use-after-free-in-remove_phb_dyn.patch patches.suse/USB-storage-ums-realtek-fix-error-code-in-rts51x_rea.patch + patches.suse/NFS-Return-valid-errors-from-nfs2-3_decode_dirent.patch + patches.suse/NFSv4.1-don-t-retry-BIND_CONN_TO_SESSION-on-session-.patch + patches.suse/NFSv4-pNFS-Fix-another-issue-with-a-list-iterator-po.patch patches.suse/can-ems_usb-ems_usb_start_xmit-fix-double-dev_kfree_.patch patches.suse/can-usb_8dev-usb_8dev_start_xmit-fix-double-dev_kfre.patch patches.suse/can-mcba_usb-mcba_usb_start_xmit-fix-double-dev_kfre.patch