* [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout
@ 2011-06-13 20:11 andros
2011-06-13 20:11 ` [PATCH Bakeathon 2/2] NFSv4.1: File layout only supports whole file layouts andros
2011-06-13 20:32 ` [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout Benny Halevy
0 siblings, 2 replies; 3+ messages in thread
From: andros @ 2011-06-13 20:11 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>
cc:stable@kernel.org [2.6.39]
---
fs/nfs/nfs4filelayout.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 2cfeaeb..3a8bd92 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -551,13 +551,16 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo,
__func__, nfl_util, fl->num_fh, fl->first_stripe_index,
fl->pattern_offset);
- if (!fl->num_fh)
+ if (fl->num_fh < 0 || fl->num_fh >
+ max(NFS4_PNFS_MAX_STRIPE_CNT, NFS4_PNFS_MAX_MULTI_CNT))
goto out_err;
- fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
- gfp_flags);
- if (!fl->fh_array)
- goto out_err;
+ if (fl->num_fh > 0) {
+ fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
+ gfp_flags);
+ if (!fl->fh_array)
+ goto out_err;
+ }
for (i = 0; i < fl->num_fh; i++) {
/* Do we want to use a mempool here? */
--
1.7.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH Bakeathon 2/2] NFSv4.1: File layout only supports whole file layouts
2011-06-13 20:11 [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout andros
@ 2011-06-13 20:11 ` andros
2011-06-13 20:32 ` [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout Benny Halevy
1 sibling, 0 replies; 3+ messages in thread
From: andros @ 2011-06-13 20:11 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/nfs4filelayout.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 3a8bd92..ada6ce1 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -427,6 +427,12 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo,
dprintk("--> %s\n", __func__);
+ if (fl->generic_hdr.pls_range.offset != 0 ||
+ fl->generic_hdr.pls_range.length != NFS4_MAX_UINT64) {
+ dprintk("%s Only whole file layouts supported. Use MDS.\n",
+ __func__);
+ goto out;
+ }
if (fl->pattern_offset > lgr->range.offset) {
dprintk("%s pattern_offset %lld too large\n",
__func__, fl->pattern_offset);
--
1.7.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout
2011-06-13 20:11 [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout andros
2011-06-13 20:11 ` [PATCH Bakeathon 2/2] NFSv4.1: File layout only supports whole file layouts andros
@ 2011-06-13 20:32 ` Benny Halevy
1 sibling, 0 replies; 3+ messages in thread
From: Benny Halevy @ 2011-06-13 20:32 UTC (permalink / raw)
To: andros; +Cc: trond.myklebust, linux-nfs
On 2011-06-13 16:11, andros@netapp.com wrote:
> From: Andy Adamson <andros@netapp.com>
>
> Signed-off-by: Andy Adamson <andros@netapp.com>
> cc:stable@kernel.org [2.6.39]
> ---
> fs/nfs/nfs4filelayout.c | 13 ++++++++-----
> 1 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> index 2cfeaeb..3a8bd92 100644
> --- a/fs/nfs/nfs4filelayout.c
> +++ b/fs/nfs/nfs4filelayout.c
> @@ -551,13 +551,16 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo,
> __func__, nfl_util, fl->num_fh, fl->first_stripe_index,
> fl->pattern_offset);
>
> - if (!fl->num_fh)
> + if (fl->num_fh < 0 || fl->num_fh >
num_fh is unsigned so checking for < 0 is not really needed.
Benny
> + max(NFS4_PNFS_MAX_STRIPE_CNT, NFS4_PNFS_MAX_MULTI_CNT))
> goto out_err;
>
> - fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
> - gfp_flags);
> - if (!fl->fh_array)
> - goto out_err;
> + if (fl->num_fh > 0) {
> + fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
> + gfp_flags);
> + if (!fl->fh_array)
> + goto out_err;
> + }
>
> for (i = 0; i < fl->num_fh; i++) {
> /* Do we want to use a mempool here? */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-13 20:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-13 20:11 [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout andros
2011-06-13 20:11 ` [PATCH Bakeathon 2/2] NFSv4.1: File layout only supports whole file layouts andros
2011-06-13 20:32 ` [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout Benny Halevy
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).