Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

NFSv4/pnfs: If the server is down, retry the layout returns on reboot

If a layout return is embedded in a CLOSE or DELEGRETURN rpc call, and
the metadata server reboots, the expectation now is that the client
should resend the layout return once the server comes back up.
This patch changes the current behaviour of dropping the layouts on the
floor, and instead queues them up for retrying.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

+37 -15
+20 -10
fs/nfs/nfs4proc.c
··· 9769 9769 if (!nfs41_sequence_process(task, &lrp->res.seq_res)) 9770 9770 return; 9771 9771 9772 - if (task->tk_rpc_status == -ETIMEDOUT) { 9773 - lrp->rpc_status = -EAGAIN; 9774 - lrp->res.lrs_present = 0; 9775 - return; 9776 - } 9777 - /* 9778 - * Was there an RPC level error? Assume the call succeeded, 9779 - * and that we need to release the layout 9780 - */ 9781 - if (task->tk_rpc_status != 0 && RPC_WAS_SENT(task)) { 9772 + if (task->tk_rpc_status < 0) { 9773 + switch (task->tk_rpc_status) { 9774 + case -EACCES: 9775 + case -EIO: 9776 + case -EKEYEXPIRED: 9777 + case -ERESTARTSYS: 9778 + case -EINTR: 9779 + lrp->rpc_status = 0; 9780 + break; 9781 + case -ENETDOWN: 9782 + case -ENETUNREACH: 9783 + if (task->tk_flags & RPC_TASK_NETUNREACH_FATAL) 9784 + lrp->rpc_status = 0; 9785 + else 9786 + lrp->rpc_status = -EAGAIN; 9787 + break; 9788 + default: 9789 + lrp->rpc_status = -EAGAIN; 9790 + break; 9791 + } 9782 9792 lrp->res.lrs_present = 0; 9783 9793 return; 9784 9794 }
+17 -5
fs/nfs/pnfs.c
··· 1698 1698 /* If the call was not sent, let caller handle it */ 1699 1699 if (!RPC_WAS_SENT(task)) 1700 1700 return 0; 1701 - /* 1702 - * Otherwise, assume the call succeeded and 1703 - * that we need to release the layout 1704 - */ 1705 - *ret = 0; 1701 + switch (task->tk_rpc_status) { 1702 + default: 1703 + /* 1704 + * Defer the layoutreturn if it was due 1705 + * to the server being down. 1706 + */ 1707 + *ret = -NFS4ERR_NOMATCHING_LAYOUT; 1708 + break; 1709 + case -EACCES: 1710 + case -EIO: 1711 + case -EKEYEXPIRED: 1712 + case -ERESTARTSYS: 1713 + case -EINTR: 1714 + /* Don't retry */ 1715 + *ret = 0; 1716 + break; 1717 + } 1706 1718 (*respp)->lrs_present = 0; 1707 1719 retval = 0; 1708 1720 break;