Skip to content

Commit cfd278c

Browse files
NeilBrowntrondmypd
authored andcommitted
NFSv4.1: nfs4_fl_prepare_ds must be careful about reporting success.
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: c23266d ("NFS4.1 Fix data server connection race") Signed-off-by: NeilBrown <[email protected]> Acked-by: Olga Kornievskaia <[email protected]> Acked-by: Adamson, Andy <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 1c48cee commit cfd278c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/nfs/filelayout/filelayoutdev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx)
282282
s->nfs_client->cl_minorversion);
283283

284284
out_test_devid:
285-
if (filelayout_test_devid_unavailable(devid))
285+
if (ret->ds_clp == NULL ||
286+
filelayout_test_devid_unavailable(devid))
286287
ret = NULL;
287288
out:
288289
return ret;

0 commit comments

Comments
 (0)