diff mbox

[1/1] nfs4.1: pnfs_find_lseg only looks at first element in list

Message ID 1308059788-17381-1-git-send-email-iisaman@netapp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fred Isaman June 14, 2011, 1:56 p.m. UTC
The break condition to skip out of the loop if we've gone too far was
reversed, causing the function to abort after looking at the first
list entry.

Reported-by: Peng Tao <peng_tao@emc.com>
Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/pnfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Benny Halevy June 14, 2011, 2:38 p.m. UTC | #1
On 2011-06-14 09:56, Fred Isaman wrote:
> The break condition to skip out of the loop if we've gone too far was
> reversed, causing the function to abort after looking at the first
> list entry.
> 
> Reported-by: Peng Tao <peng_tao@emc.com>
> Signed-off-by: Fred Isaman <iisaman@netapp.com>
> ---
>  fs/nfs/pnfs.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 1abb300..c640f91 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -895,7 +895,7 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo,
>  			ret = get_lseg(lseg);
>  			break;
>  		}
> -		if (cmp_layout(range, &lseg->pls_range) > 0)
> +		if (cmp_layout(range, &lseg->pls_range) < 0)

Fred, this is too harsh since we might break if range->offset == lseg->pls_range.offset
&& range->length > lseg->pls_range.length.

The simplest condition is just:
		if (lseg->pls_range.offset > range->offset)

Benny

>  			break;
>  	}
>  
--
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 mbox

Patch

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 1abb300..c640f91 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -895,7 +895,7 @@  pnfs_find_lseg(struct pnfs_layout_hdr *lo,
 			ret = get_lseg(lseg);
 			break;
 		}
-		if (cmp_layout(range, &lseg->pls_range) > 0)
+		if (cmp_layout(range, &lseg->pls_range) < 0)
 			break;
 	}