Blob Blame History Raw
From: NeilBrown <neilb@suse.com>
Subject: NFSv4.x: by default serialize open/close operations.
References: bsc#1114893 bsc#1195934
Patch-mainline: never, a better fix is needed

NFSv4.1 and later allow open, open_downgrade, and close operations
on a given file to occur in parallel and provides a way for the server
to unambiguously indicate which operation was processed last.

Unfortuantely, the results in a number of races which are not correctly
handled by the Linux client code.  Some have been fixed since 4.4,
others have not.

The easiest way to ensure correct behaviour is to revert to the
NFSv4.0 practice of serializing these operations.

In 4.12 (for SLE12-SP4) we shouldn't need this patch as those races in
the client code have been fixed.
However there seems to be a NetApp server bug which is avoided by
this patch.  So the customer experience is that NFSv4.1 works to the
Netapp in SLE12-SP3, but not in SLE12-SP4.  We don't want them to have
that experience.  So it is being added to SP4 too.

Some customers might not have the buggy server and might need the
parallel opens, so a module parameter controls this work-around.
By default, opens are not parallelized.
With nfs module parameter "serialize_opens=N", the opens will not be
serialized - they can occur in parallel.

It will not be added to SLE15 - the same justification doesn't hold.

Signed-off-by: NeilBrown <neilb@suse.com>
Acked-by: NeilBrown <neilb@suse.com>

---
 fs/nfs/nfs4proc.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -9426,9 +9426,16 @@ static const struct nfs4_minor_version_o
 };
 
 #if defined(CONFIG_NFS_V4_1)
+static bool serialize_opens = true;
+module_param(serialize_opens, bool, 0644);
+MODULE_PARM_DESC(serialize_opens,
+		 "Serialize all open/close to each file - avoids some server bugs");
+
 static struct nfs_seqid *
 nfs_alloc_no_seqid(struct nfs_seqid_counter *arg1, gfp_t arg2)
 {
+	if (serialize_opens)
+		return nfs_alloc_seqid(arg1, arg2);
 	return NULL;
 }