* [PATCH Version 2 0/3] NFSv4.1 Fix gdia_maxcount calculation to fit in ca_maxresponsesize
@ 2013-06-25 23:02 andros
2013-06-25 23:02 ` [PATCH Version 2 1/3] " andros
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: andros @ 2013-06-25 23:02 UTC (permalink / raw)
To: trond.myklebust; +Cc: linux-nfs, Andy Adamson
From: Andy Adamson <andros@netapp.com>
>From Trond:
> 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...
AFAICS there are two roles: the reply or total message length used for
xdr_init_decode_pages (where it is also a function argument) and the
gdia_maxcount.
Put the block and object layout change in separate patches for ease of
backporting.
-->Andy
Andy Adamson (3):
NFSv4.1 Fix gdia_maxcount calculation to fit in ca_maxresponsesize
NFSv4.1 use pnfs_device maxcount for the blocklayout gdia_maxcount
NFSv4.1 use pnfs_device maxcount for the objectlayout gdia_maxcount
fs/nfs/blocklayout/blocklayout.c | 1 +
fs/nfs/internal.h | 1 +
fs/nfs/nfs4filelayoutdev.c | 1 +
fs/nfs/nfs4xdr.c | 8 +++++++-
fs/nfs/objlayout/objlayout.c | 1 +
fs/nfs/pnfs.h | 3 ++-
6 files changed, 13 insertions(+), 2 deletions(-)
--
1.7.11.7
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH Version 2 1/3] NFSv4.1 Fix gdia_maxcount calculation to fit in ca_maxresponsesize
2013-06-25 23:02 [PATCH Version 2 0/3] NFSv4.1 Fix gdia_maxcount calculation to fit in ca_maxresponsesize andros
@ 2013-06-25 23:02 ` andros
2013-06-25 23:02 ` [PATCH Version 2 2/3] NFSv4.1 use pnfs_device maxcount for the blocklayout gdia_maxcount andros
2013-06-25 23:02 ` [PATCH Version 2 3/3] NFSv4.1 use pnfs_device maxcount for the objectlayout gdia_maxcount andros
2 siblings, 0 replies; 4+ messages in thread
From: andros @ 2013-06-25 23:02 UTC (permalink / raw)
To: trond.myklebust; +Cc: linux-nfs, Andy Adamson
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).
Split out the struct pnfs_device field maxcount which is the gdia_maxcount
from the pglen field which is the reply (the total) buffer length.
Signed-off-by: Andy Adamson <andros@netapp.com>
---
fs/nfs/internal.h | 1 +
fs/nfs/nfs4filelayoutdev.c | 1 +
fs/nfs/nfs4xdr.c | 8 +++++++-
fs/nfs/pnfs.h | 3 ++-
4 files changed, 11 insertions(+), 2 deletions(-)
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..95604f6 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -711,6 +711,7 @@ filelayout_get_device_info(struct inode *inode,
pdev->pgbase = 0;
pdev->pglen = max_resp_sz;
pdev->mincount = 0;
+ pdev->maxcount = max_resp_sz - nfs41_maxgetdevinfo_overhead;
rc = nfs4_proc_getdeviceinfo(server, pdev, cred);
dprintk("%s getdevice info returns %d\n", __func__, rc);
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 2a3f77e1..0abfb846 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[] = {
@@ -1924,7 +1930,7 @@ encode_getdeviceinfo(struct xdr_stream *xdr,
p = xdr_encode_opaque_fixed(p, args->pdev->dev_id.data,
NFS4_DEVICEID4_SIZE);
*p++ = cpu_to_be32(args->pdev->layout_type);
- *p++ = cpu_to_be32(args->pdev->pglen); /* gdia_maxcount */
+ *p++ = cpu_to_be32(args->pdev->maxcount); /* gdia_maxcount */
*p++ = cpu_to_be32(0); /* bitmap length 0 */
}
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 1441dff..a4f4181 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -149,9 +149,10 @@ struct pnfs_device {
struct nfs4_deviceid dev_id;
unsigned int layout_type;
unsigned int mincount;
+ unsigned int maxcount; /* gdia_maxcount */
struct page **pages;
unsigned int pgbase;
- unsigned int pglen;
+ unsigned int pglen; /* reply buffer length */
};
#define NFS4_PNFS_GETDEVLIST_MAXNUM 16
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH Version 2 2/3] NFSv4.1 use pnfs_device maxcount for the blocklayout gdia_maxcount
2013-06-25 23:02 [PATCH Version 2 0/3] NFSv4.1 Fix gdia_maxcount calculation to fit in ca_maxresponsesize andros
2013-06-25 23:02 ` [PATCH Version 2 1/3] " andros
@ 2013-06-25 23:02 ` andros
2013-06-25 23:02 ` [PATCH Version 2 3/3] NFSv4.1 use pnfs_device maxcount for the objectlayout gdia_maxcount andros
2 siblings, 0 replies; 4+ messages in thread
From: andros @ 2013-06-25 23:02 UTC (permalink / raw)
To: trond.myklebust; +Cc: linux-nfs, Andy Adamson
From: Andy Adamson <andros@netapp.com>
Signed-off-by: Andy Adamson <andros@netapp.com>
---
fs/nfs/blocklayout/blocklayout.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 1e5fdd3..e242bbf 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -1089,6 +1089,7 @@ nfs4_blk_get_deviceinfo(struct nfs_server *server, const struct nfs_fh *fh,
dev->pgbase = 0;
dev->pglen = PAGE_SIZE * max_pages;
dev->mincount = 0;
+ dev->maxcount = max_resp_sz - nfs41_maxgetdevinfo_overhead;
dprintk("%s: dev_id: %s\n", __func__, dev->dev_id.data);
rc = nfs4_proc_getdeviceinfo(server, dev, NULL);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH Version 2 3/3] NFSv4.1 use pnfs_device maxcount for the objectlayout gdia_maxcount
2013-06-25 23:02 [PATCH Version 2 0/3] NFSv4.1 Fix gdia_maxcount calculation to fit in ca_maxresponsesize andros
2013-06-25 23:02 ` [PATCH Version 2 1/3] " andros
2013-06-25 23:02 ` [PATCH Version 2 2/3] NFSv4.1 use pnfs_device maxcount for the blocklayout gdia_maxcount andros
@ 2013-06-25 23:02 ` andros
2 siblings, 0 replies; 4+ messages in thread
From: andros @ 2013-06-25 23:02 UTC (permalink / raw)
To: trond.myklebust; +Cc: linux-nfs, Andy Adamson
From: Andy Adamson <andros@netapp.com>
Signed-off-by: Andy Adamson <andros@netapp.com>
---
fs/nfs/objlayout/objlayout.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c
index 1989908..e4f9cbf 100644
--- a/fs/nfs/objlayout/objlayout.c
+++ b/fs/nfs/objlayout/objlayout.c
@@ -613,6 +613,7 @@ int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay,
pd.pgbase = 0;
pd.pglen = PAGE_SIZE;
pd.mincount = 0;
+ pd.maxcount = PAGE_SIZE;
err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd,
pnfslay->plh_lc_cred);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-25 23:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-25 23:02 [PATCH Version 2 0/3] NFSv4.1 Fix gdia_maxcount calculation to fit in ca_maxresponsesize andros
2013-06-25 23:02 ` [PATCH Version 2 1/3] " andros
2013-06-25 23:02 ` [PATCH Version 2 2/3] NFSv4.1 use pnfs_device maxcount for the blocklayout gdia_maxcount andros
2013-06-25 23:02 ` [PATCH Version 2 3/3] NFSv4.1 use pnfs_device maxcount for the objectlayout gdia_maxcount andros
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).