Message ID | 1372185454-1888-3-git-send-email-andros@netapp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, 2013-06-25 at 14:37 -0400, andros@netapp.com wrote: > From: Andy Adamson <andros@netapp.com> > > The GETDEVICEINFO gdia_maxcount represents all of the data being returned > within the GETDEVICEINFO4resok structure and includes the XDR overhead. > > The CREATE_SESSION ca_maxresponsesize is the maximum reply and includes the RPC > headers (including security flavor credentials and verifiers). This still looks wrong. The problem is that pdev->pglen is used both as the total buffer length, as a function argument and as the reply message length (through the call to xdr_init_decode_pages). We really should split out those 3 different roles...
On Jun 25, 2013, at 3:28 PM, "Myklebust, Trond" <Trond.Myklebust@netapp.com> wrote: > On Tue, 2013-06-25 at 14:37 -0400, andros@netapp.com wrote: >> From: Andy Adamson <andros@netapp.com> >> >> The GETDEVICEINFO gdia_maxcount represents all of the data being returned >> within the GETDEVICEINFO4resok structure and includes the XDR overhead. >> >> The CREATE_SESSION ca_maxresponsesize is the maximum reply and includes the RPC >> headers (including security flavor credentials and verifiers). > > This still looks wrong. > > The problem is that pdev->pglen is used both as the total buffer length, > as a function argument and as the reply message length (through the call > to xdr_init_decode_pages). We really should split out those 3 different > roles… Ah. OK, I'll split them out... -->Andy > > -- > Trond Myklebust > Linux NFS client maintainer > > NetApp > Trond.Myklebust@netapp.com > www.netapp.com -- 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
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 97ec2ef..3c8373f 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -255,6 +255,7 @@ extern int nfs4_decode_dirent(struct xdr_stream *, #ifdef CONFIG_NFS_V4_1 extern const u32 nfs41_maxread_overhead; extern const u32 nfs41_maxwrite_overhead; +extern const u32 nfs41_maxgetdevinfo_overhead; #endif /* nfs4proc.c */ diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index 0493dbd..749ca61 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c @@ -709,7 +709,7 @@ filelayout_get_device_info(struct inode *inode, pdev->layout_type = LAYOUT_NFSV4_1_FILES; pdev->pages = pages; pdev->pgbase = 0; - pdev->pglen = max_resp_sz; + pdev->pglen = max_resp_sz - nfs41_maxgetdevinfo_overhead; pdev->mincount = 0; rc = nfs4_proc_getdeviceinfo(server, pdev, cred); diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 2a3f77e1..dde8e17 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -867,6 +867,12 @@ const u32 nfs41_maxread_overhead = ((RPC_MAX_HEADER_WITH_AUTH + decode_sequence_maxsz + decode_putfh_maxsz) * XDR_UNIT); + +const u32 nfs41_maxgetdevinfo_overhead = ((RPC_MAX_REPHEADER_WITH_AUTH + + compound_decode_hdr_maxsz + + decode_sequence_maxsz) * + XDR_UNIT); +EXPORT_SYMBOL_GPL(nfs41_maxgetdevinfo_overhead); #endif /* CONFIG_NFS_V4_1 */ static const umode_t nfs_type2fmt[] = {