Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 218009 Details for
Bug 300907
Assert in XFS
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
backported patch to fix readahead calculations in xfs_dir2_leaf_getdents()
fix-readahead-calcs.patch (text/plain), 2.20 KB, created by
Mike Pagano
on 2010-01-31 19:34:11 UTC
(
hide
)
Description:
backported patch to fix readahead calculations in xfs_dir2_leaf_getdents()
Filename:
MIME Type:
Creator:
Mike Pagano
Created:
2010-01-31 19:34:11 UTC
Size:
2.20 KB
patch
obsolete
>From: Eric Sandeen <sandeen@sandeen.net> >Date: Fri, 25 Sep 2009 19:42:26 +0000 (+0000) >Subject: fix readahead calculations in xfs_dir2_leaf_getdents() >X-Git-Tag: v2.6.32-rc6~49^2~2 >X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=8e69ce147127a0235e8d1f2b75ea214be78c61b3 > >fix readahead calculations in xfs_dir2_leaf_getdents() > >This is for bug #850, >http://oss.sgi.com/bugzilla/show_bug.cgi?id=850 >XFS file system segfaults , repeatedly and 100% reproducable in 2.6.30 , 2.6.31 > >The above only showed up on a CONFIG_XFS_DEBUG=y kernel, because >xfs_bmapi() ASSERTs that it has been asked for at least one map, > >and it was getting 0. > >The root cause is that our guesstimated "bufsize" from xfs_file_readdir >was fairly small, and the > > bufsize -= length; > >in the loop was going negative - except bufsize is a size_t, so it >was wrapping to a very large number. > >Then when we did > ra_want = howmany(bufsize + mp->m_dirblksize, > mp->m_sb.sb_blocksize) - 1; > >with that very large number, the (int) ra_want was coming out >negative, and a subsequent compare: > > if (1 + ra_want > map_blocks ... > >was coming out -true- (negative int compare w/ uint) and we went >back to xfs_bmapi() for more, even though we did not need more, >and asked for 0 maps, and hit the ASSERT. > >We have kind of a type mess here, but just keeping bufsize from >going negative is probably sufficient to avoid the problem. > >Signed-off-by: Eric Sandeen <sandeen@sandeen.net> >Reviewed-by: Christoph Hellwig <hch@lst.de> >Reviewed-by: Alex Elder <aelder@sgi.com> >Signed-off-by: Alex Elder <aelder@sgi.com> >--- > >diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c >index fa913e4..41ad537 100644 >--- a/fs/xfs/xfs_dir2_leaf.c >+++ b/fs/xfs/xfs_dir2_leaf.c >@@ -854,6 +854,7 @@ xfs_dir2_leaf_getdents( > */ > ra_want = howmany(bufsize + mp->m_dirblksize, > mp->m_sb.sb_blocksize) - 1; >+ ASSERT(ra_want >= 0); > > /* > * If we don't have as many as we want, and we haven't >@@ -1088,7 +1089,8 @@ xfs_dir2_leaf_getdents( > */ > ptr += length; > curoff += length; >- bufsize -= length; >+ /* bufsize may have just been a guess; don't go negative */ >+ bufsize = bufsize > length ? bufsize - length : 0; > } > > /* >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 300907
:
216772
| 218009