Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix off-by-one in fiemap
@ 2013-05-01 16:23 Liu Bo
  2013-05-06 19:45 ` Josef Bacik
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2013-05-01 16:23 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

lock_extent/unlock_extent expect an exclusive end.

Tested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/extent_io.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index cdee391..e3aafce 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3913,7 +3913,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 		last_for_get_extent = isize;
 	}
 
-	lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0,
+	lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len - 1, 0,
 			 &cached_state);
 
 	em = get_extent_skip_holes(inode, start, last_for_get_extent,
@@ -4000,7 +4000,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 out_free:
 	free_extent_map(em);
 out:
-	unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, start + len,
+	unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, start + len - 1,
 			     &cached_state, GFP_NOFS);
 	return ret;
 }
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Btrfs: fix off-by-one in fiemap
  2013-05-01 16:23 [PATCH] Btrfs: fix off-by-one in fiemap Liu Bo
@ 2013-05-06 19:45 ` Josef Bacik
  2013-05-07 10:52   ` Liu Bo
  0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2013-05-06 19:45 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs@vger.kernel.org, David Sterba

On Wed, May 01, 2013 at 10:23:41AM -0600, Liu Bo wrote:
> lock_extent/unlock_extent expect an exclusive end.
> 

Can you make an xfstest for this so we can make sure we don't screw this up in
the future?  Thanks,

Josef

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Btrfs: fix off-by-one in fiemap
  2013-05-06 19:45 ` Josef Bacik
@ 2013-05-07 10:52   ` Liu Bo
  2013-05-07 12:25     ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2013-05-07 10:52 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs@vger.kernel.org, David Sterba

On Mon, May 06, 2013 at 03:45:16PM -0400, Josef Bacik wrote:
> On Wed, May 01, 2013 at 10:23:41AM -0600, Liu Bo wrote:
> > lock_extent/unlock_extent expect an exclusive end.
> > 
> 
> Can you make an xfstest for this so we can make sure we don't screw this up in
> the future?  Thanks,

Hi Josef,

I wish I could, but I don't know how to test this in a xfstest case...
David has made a debug checker in kernel to cover this.

thanks,
liubo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Btrfs: fix off-by-one in fiemap
  2013-05-07 10:52   ` Liu Bo
@ 2013-05-07 12:25     ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2013-05-07 12:25 UTC (permalink / raw)
  To: Liu Bo; +Cc: Josef Bacik, linux-btrfs@vger.kernel.org, David Sterba

On Tue, May 07, 2013 at 06:52:49PM +0800, Liu Bo wrote:
> On Mon, May 06, 2013 at 03:45:16PM -0400, Josef Bacik wrote:
> > Can you make an xfstest for this so we can make sure we don't screw this up in
> > the future?  Thanks,
> 
> I wish I could, but I don't know how to test this in a xfstest case...
> David has made a debug checker in kernel to cover this.

If CONFIG_BTRFS_DEBUG is on, a test similar to what I used back then
would cover the boundary conditions.

http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg21021.html

Looking at existing tests, 285 is a 'seek sanity test' that has several
subtests inside. This looks like the right place to put it in.

david

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-07 12:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-01 16:23 [PATCH] Btrfs: fix off-by-one in fiemap Liu Bo
2013-05-06 19:45 ` Josef Bacik
2013-05-07 10:52   ` Liu Bo
2013-05-07 12:25     ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox