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

NFSv4.1/pnfs: Handle LAYOUTGET return values correctly

According to RFC5661 section 18.43.3, if the server cannot satisfy
the loga_minlength argument to LAYOUTGET, there are 2 cases:
1) If loga_minlength == 0, it returns NFS4ERR_LAYOUTTRYLATER
2) If loga_minlength != 0, it returns NFS4ERR_BADLAYOUT

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

+14 -1
+14 -1
fs/nfs/nfs4proc.c
··· 7781 7781 case 0: 7782 7782 goto out; 7783 7783 /* 7784 + * NFS4ERR_BADLAYOUT means the MDS cannot return a layout of 7785 + * length lgp->args.minlength != 0 (see RFC5661 section 18.43.3). 7786 + */ 7787 + case -NFS4ERR_BADLAYOUT: 7788 + goto out_overflow; 7789 + /* 7784 7790 * NFS4ERR_LAYOUTTRYLATER is a conflict with another client 7785 - * (or clients) writing to the same RAID stripe 7791 + * (or clients) writing to the same RAID stripe except when 7792 + * the minlength argument is 0 (see RFC5661 section 18.43.3). 7786 7793 */ 7787 7794 case -NFS4ERR_LAYOUTTRYLATER: 7795 + if (lgp->args.minlength == 0) 7796 + goto out_overflow; 7788 7797 /* 7789 7798 * NFS4ERR_RECALLCONFLICT is when conflict with self (must recall 7790 7799 * existing layout before getting a new one). ··· 7849 7840 rpc_restart_call_prepare(task); 7850 7841 out: 7851 7842 dprintk("<-- %s\n", __func__); 7843 + return; 7844 + out_overflow: 7845 + task->tk_status = -EOVERFLOW; 7846 + goto out; 7852 7847 } 7853 7848 7854 7849 static size_t max_response_pages(struct nfs_server *server)