Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df3ab232 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker
Browse files

pNFS/flexfiles: If the layout is invalid, it must be updated before retrying



If we see that our pNFS READ/WRITE/COMMIT operation failed, but we
also see that our layout segment is no longer valid, then we need to
get a new layout segment before retrying.

Fixes: 90816d1d ("NFSv4.1/flexfiles: Don't mark the entire deviceid...")
Cc: stable@vger.kernel.org # v4.2+
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 686a816a
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -1053,9 +1053,6 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
	struct nfs_client *mds_client = mds_server->nfs_client;
	struct nfs_client *mds_client = mds_server->nfs_client;
	struct nfs4_slot_table *tbl = &clp->cl_session->fc_slot_table;
	struct nfs4_slot_table *tbl = &clp->cl_session->fc_slot_table;


	if (task->tk_status >= 0)
		return 0;

	switch (task->tk_status) {
	switch (task->tk_status) {
	/* MDS state errors */
	/* MDS state errors */
	case -NFS4ERR_DELEG_REVOKED:
	case -NFS4ERR_DELEG_REVOKED:
@@ -1157,9 +1154,6 @@ static int ff_layout_async_handle_error_v3(struct rpc_task *task,
{
{
	struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);
	struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);


	if (task->tk_status >= 0)
		return 0;

	switch (task->tk_status) {
	switch (task->tk_status) {
	/* File access problems. Don't mark the device as unavailable */
	/* File access problems. Don't mark the device as unavailable */
	case -EACCES:
	case -EACCES:
@@ -1195,6 +1189,13 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
{
{
	int vers = clp->cl_nfs_mod->rpc_vers->number;
	int vers = clp->cl_nfs_mod->rpc_vers->number;


	if (task->tk_status >= 0)
		return 0;

	/* Handle the case of an invalid layout segment */
	if (!pnfs_is_valid_lseg(lseg))
		return -NFS4ERR_RESET_TO_PNFS;

	switch (vers) {
	switch (vers) {
	case 3:
	case 3:
		return ff_layout_async_handle_error_v3(task, lseg, idx);
		return ff_layout_async_handle_error_v3(task, lseg, idx);