[Version,1,1/1] NFS free the layoutget slot before calling pnfs_layout_process
diff mbox

Message ID 20170315151851.5762-1-andros@netapp.com
State New
Headers show

Commit Message

Andy Adamson March 15, 2017, 3:18 p.m. UTC
From: Andy Adamson <andros@netapp.com>

Otherwise no slots could be available for the potential
pnfs_layout_process getdeviceinfo call and the client hangs on pNFS I/O.

This occurs in testing against the pynfs pNFS server where the
the on-wire reply highest_slotid and slot id are zero, and the
target high slot id is 8 (negotiated in CREATE_SESSION).

The internal fore channel slot table max_slotid, the maximum allowed
table slotid value, has been reduced via nfs41_set_max_slotid_locked
 from 8 to 1.  Thus there is one slot (slotid 0) available for use but
it has not been freed by layoutget proir to the getdeviceinfo request.

So the layout get call is waiting for the getdeviceinfo call to complete,
and the getdeviceinfo call is waiting for layoutget to free the slot.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Trond Myklebust March 15, 2017, 7:09 p.m. UTC | #1
On Wed, 2017-03-15 at 11:18 -0400, andros@netapp.com wrote:
> From: Andy Adamson <andros@netapp.com>

> 

> Otherwise no slots could be available for the potential

> pnfs_layout_process getdeviceinfo call and the client hangs on pNFS

> I/O.

> 

> This occurs in testing against the pynfs pNFS server where the

> the on-wire reply highest_slotid and slot id are zero, and the

> target high slot id is 8 (negotiated in CREATE_SESSION).

> 

> The internal fore channel slot table max_slotid, the maximum allowed

> table slotid value, has been reduced via nfs41_set_max_slotid_locked

>  from 8 to 1.  Thus there is one slot (slotid 0) available for use

> but

> it has not been freed by layoutget proir to the getdeviceinfo

> request.

> 

> So the layout get call is waiting for the getdeviceinfo call to

> complete,

> and the getdeviceinfo call is waiting for layoutget to free the slot.

> 

> Signed-off-by: Andy Adamson <andros@netapp.com>

> ---

>  fs/nfs/nfs4proc.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c

> index 1b18368..8ca92d0 100644

> --- a/fs/nfs/nfs4proc.c

> +++ b/fs/nfs/nfs4proc.c

> @@ -8504,10 +8504,10 @@ nfs4_proc_layoutget(struct nfs4_layoutget

> *lgp, long *timeout, gfp_t gfp_flags)

>  			&lgp->res.stateid,

>  			status);

>  

> +	nfs4_sequence_free_slot(&lgp->res.seq_res);

>  	/* if layoutp->len is 0, nfs4_layoutget_prepare called

> rpc_exit */

>  	if (status == 0 && lgp->res.layoutp->len)

>  		lseg = pnfs_layout_process(lgp);

> -	nfs4_sequence_free_slot(&lgp->res.seq_res);

>  	rpc_put_task(task);

>  	dprintk("<-- %s status=%d\n", __func__, status);

>  	if (status)


The placement of the call to nfs4_sequence_free_slot() after the call
to pnfs_layout_process() is deliberate, and is needed in order to
ensure that layoutrecall callbacks are processed correctly in order
after the layoutget has been processed (see referring_call_exists()).

The call to nfs4_find_get_deviceid() needs to be moved out of
pnfs_update_layout().
In the flexfiles driver, it was moved to nfs4_ff_layout_prepare_ds(),
but it looks to me as if the files driver needs to call it earlier due
to the need to calculate stripes. Perhaps the right thing is to add a
wrapper around pnfs_update_layout() in fs/nfs/filelayout/filelayout.c
that can be called by both filelayout_pg_init_read() and
filelayout_pg_init_write()?

-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com
Adamson, Andy March 15, 2017, 7:18 p.m. UTC | #2
T0sg4oCTIEnigJlsbCB0YWtlIGEgbG9vay4NCg0KVGhhbmtzDQoNCuKGkkFuZHkNCg0KT24gMy8x
NS8xNywgMzowOSBQTSwgIlRyb25kIE15a2xlYnVzdCIgPHRyb25kbXlAcHJpbWFyeWRhdGEuY29t
PiB3cm90ZToNCg0KT24gV2VkLCAyMDE3LTAzLTE1IGF0IDExOjE4IC0wNDAwLCBhbmRyb3NAbmV0
YXBwLmNvbSB3cm90ZToNCj4gRnJvbTogQW5keSBBZGFtc29uIDxhbmRyb3NAbmV0YXBwLmNvbT4N
Cj4gDQo+IE90aGVyd2lzZSBub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vbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXIsIFByaW1h
cnlEYXRhDQp0cm9uZC5teWtsZWJ1c3RAcHJpbWFyeWRhdGEuY29tDQoNCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1b18368..8ca92d0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -8504,10 +8504,10 @@  nfs4_proc_layoutget(struct nfs4_layoutget *lgp, long *timeout, gfp_t gfp_flags)
 			&lgp->res.stateid,
 			status);
 
+	nfs4_sequence_free_slot(&lgp->res.seq_res);
 	/* if layoutp->len is 0, nfs4_layoutget_prepare called rpc_exit */
 	if (status == 0 && lgp->res.layoutp->len)
 		lseg = pnfs_layout_process(lgp);
-	nfs4_sequence_free_slot(&lgp->res.seq_res);
 	rpc_put_task(task);
 	dprintk("<-- %s status=%d\n", __func__, status);
 	if (status)