On Mon, Jan 07, 2013 at 05:20:50PM +0100, David Sterba wrote: > On Mon, Jan 07, 2013 at 11:53:08AM +0800, Liu Bo wrote: > > Lock end is inclusive. > > > > Signed-off-by: Liu Bo <[email protected]> > > --- > > fs/btrfs/file.c | 1 + > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > > diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c > > index 77061bf..1e16b6d 100644 > > --- a/fs/btrfs/file.c > > +++ b/fs/btrfs/file.c > > @@ -2241,6 +2241,7 @@ static int find_desired_extent(struct inode *inode, > > loff_t *offset, int whence) > > if (lockend <= lockstart) > > lockend = lockstart + root->sectorsize; > > > > + lockend--; > > len = lockend - lockstart + 1; > > > > len = max_t(u64, len, root->sectorsize); > > Fix looks ok. I think this should be caught at runtime as well, the > number of ways how the lock start and end are passed is not small and it > need not be always possible to catch it from reading sources. The range > is inclusive, so it's 'lock end % 2 == 1' right? (in the bit > manipulating primitives).
Hmm, not always here, lockend = inode->i_size - 1, so lockend % 2 == 1 may not be true. But this check can worked in those places where we've rounded the range up to PAGE_SIZE :) thanks, liubo -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
