Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-08-16 22:01:45 +0200
committerJiri Slaby <jslaby@suse.cz>2019-08-16 22:25:11 +0200
commita2ebdefd19237cefe9e2277ffb506b09b010fdd3 (patch)
tree1f3fe6c9d00fa612cd587faf607e13ec3aac8308
parent86a725821d623d8aea2f961130d7095d289507c4 (diff)
NFSv4: Check the return value of update_open_stateid()
-rw-r--r--patches.kernel.org/5.2.9-135-NFSv4-Check-the-return-value-of-update_open_sta.patch55
-rw-r--r--series.conf1
2 files changed, 56 insertions, 0 deletions
diff --git a/patches.kernel.org/5.2.9-135-NFSv4-Check-the-return-value-of-update_open_sta.patch b/patches.kernel.org/5.2.9-135-NFSv4-Check-the-return-value-of-update_open_sta.patch
new file mode 100644
index 0000000000..5f51976f78
--- /dev/null
+++ b/patches.kernel.org/5.2.9-135-NFSv4-Check-the-return-value-of-update_open_sta.patch
@@ -0,0 +1,55 @@
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+Date: Mon, 29 Jul 2019 18:25:00 +0100
+Subject: [PATCH] NFSv4: Check the return value of update_open_stateid()
+References: bnc#1012628
+Patch-mainline: 5.2.9
+Git-commit: e3c8dc761ead061da2220ee8f8132f729ac3ddfe
+
+commit e3c8dc761ead061da2220ee8f8132f729ac3ddfe upstream.
+
+Ensure that we always check the return value of update_open_stateid()
+so that we can retry if the update of local state failed. This fixes
+infinite looping on state recovery.
+
+Fixes: e23008ec81ef3 ("NFSv4 reduce attribute requests for open reclaim")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Cc: stable@vger.kernel.org # v3.7+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/nfs/nfs4proc.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+index 61a01e1399ac..fe02a4f6f6d3 100644
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -1878,8 +1878,9 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
+ if (data->o_res.delegation_type != 0)
+ nfs4_opendata_check_deleg(data, state);
+ update:
+- update_open_stateid(state, &data->o_res.stateid, NULL,
+- data->o_arg.fmode);
++ if (!update_open_stateid(state, &data->o_res.stateid,
++ NULL, data->o_arg.fmode))
++ return ERR_PTR(-EAGAIN);
+ refcount_inc(&state->count);
+
+ return state;
+@@ -1944,8 +1945,11 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data)
+
+ if (data->o_res.delegation_type != 0)
+ nfs4_opendata_check_deleg(data, state);
+- update_open_stateid(state, &data->o_res.stateid, NULL,
+- data->o_arg.fmode);
++ if (!update_open_stateid(state, &data->o_res.stateid,
++ NULL, data->o_arg.fmode)) {
++ nfs4_put_open_state(state);
++ state = ERR_PTR(-EAGAIN);
++ }
+ out:
+ nfs_release_seqid(data->o_arg.seqid);
+ return state;
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index 396275ae96..bb080f2591 100644
--- a/series.conf
+++ b/series.conf
@@ -1155,6 +1155,7 @@
patches.kernel.org/5.2.9-132-SMB3-Fix-deadlock-in-validate-negotiate-hits-re.patch
patches.kernel.org/5.2.9-133-smb3-send-CAP_DFS-capability-during-session-set.patch
patches.kernel.org/5.2.9-134-NFSv4-Fix-delegation-state-recovery.patch
+ patches.kernel.org/5.2.9-135-NFSv4-Check-the-return-value-of-update_open_sta.patch
########################################################
# Build fixes that apply to the vanilla kernel too.