linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFSv4.1: nfs4_fl_prepare_ds must be careful about reporting success.
@ 2016-10-21  0:01 NeilBrown
  2016-11-18  5:01 ` NeilBrown
  0 siblings, 1 reply; 9+ messages in thread
From: NeilBrown @ 2016-10-21  0:01 UTC (permalink / raw)
  To: Andy Adamson, Trond Myklebust, Anna Schumaker; +Cc: Linux NFS Mailing List

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]


Various places assume that if nfs4_fl_prepare_ds() turns a non-NULL
'ds', then ds->ds_clp will also be non-NULL.

This is not necessasrily true in the case when the process received a
fatal signal while nfs4_pnfs_ds_connect is waiting in
nfs4_wait_ds_connect().  In that case ->ds_clp may not be set, and the
devid may not recently have been marked unavailable.

So add a test for ->ds_clp == NULL and return NULL in that case.

Fixes: c23266d532b4 ("NFS4.1 Fix data server connection race")
Signed-off-by: NeilBrown <neilb@suse.com>
---
 fs/nfs/filelayout/filelayoutdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/filelayout/filelayoutdev.c b/fs/nfs/filelayout/filelayoutdev.c
index 4946ef40ba87..85ef38f9765f 100644
--- a/fs/nfs/filelayout/filelayoutdev.c
+++ b/fs/nfs/filelayout/filelayoutdev.c
@@ -283,7 +283,8 @@ nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx)
 			     s->nfs_client->cl_rpcclient->cl_auth->au_flavor);
 
 out_test_devid:
-	if (filelayout_test_devid_unavailable(devid))
+	if (ret->ds_clp == NULL ||
+	    filelayout_test_devid_unavailable(devid))
 		ret = NULL;
 out:
 	return ret;
-- 
2.10.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-12-19  0:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-21  0:01 [PATCH] NFSv4.1: nfs4_fl_prepare_ds must be careful about reporting success NeilBrown
2016-11-18  5:01 ` NeilBrown
2016-11-18 14:32   ` Trond Myklebust
2016-11-18 17:34     ` Olga Kornievskaia
2016-11-19  6:33       ` NeilBrown
2016-11-22 20:32         ` Adamson, Andy
2016-11-23 17:37         ` Olga Kornievskaia
2016-12-19  0:19           ` [PATCH resend] " NeilBrown
2016-12-19  0:28             ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).