<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/fs/xfs/scrub, branch linux-5.3.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-5.3.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-5.3.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2019-07-30T18:28:20+00:00</updated>
<entry>
<title>xfs: Fix possible null-pointer dereferences in xchk_da_btree_block_check_sibling()</title>
<updated>2019-07-30T18:28:20+00:00</updated>
<author>
<name>Jia-Ju Bai</name>
<email>baijiaju1990@gmail.com</email>
</author>
<published>2019-07-30T18:28:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=afa1d96d1430c2138c545fb76e6dcb21222098d4'/>
<id>urn:sha1:afa1d96d1430c2138c545fb76e6dcb21222098d4</id>
<content type='text'>
In xchk_da_btree_block_check_sibling(), there is an if statement on
line 274 to check whether ds-&gt;state-&gt;altpath.blk[level].bp is NULL:
    if (ds-&gt;state-&gt;altpath.blk[level].bp)

When ds-&gt;state-&gt;altpath.blk[level].bp is NULL, it is used on line 281:
    xfs_trans_brelse(..., ds-&gt;state-&gt;altpath.blk[level].bp);
        struct xfs_buf_log_item *bip = bp-&gt;b_log_item;
        ASSERT(bp-&gt;b_transp == tp);

Thus, possible null-pointer dereferences may occur.

To fix these bugs, ds-&gt;state-&gt;altpath.blk[level].bp is checked before
being used.

These bugs are found by a static analysis tool STCheck written by us.

Signed-off-by: Jia-Ju Bai &lt;baijiaju1990@gmail.com&gt;
Reviewed-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
</content>
</entry>
<entry>
<title>xfs: online scrub needn't bother zeroing its temporary buffer</title>
<updated>2019-07-05T17:29:56+00:00</updated>
<author>
<name>Darrick J. Wong</name>
<email>darrick.wong@oracle.com</email>
</author>
<published>2019-07-05T17:29:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=036f463fe15db26c2d90724203e4a7ea8f9b8580'/>
<id>urn:sha1:036f463fe15db26c2d90724203e4a7ea8f9b8580</id>
<content type='text'>
The xattr scrubber functions use the temporary memory buffer either for
storing bitmaps or for testing if attribute value extraction works.  The
bitmap code always zeroes what it needs and the value extraction sets
the buffer contents, so it's not necessary to waste CPU time zeroing on
allocation.

Note that while we never read the contents that the attr value
extraction function sets, we do need to call it to check the remote
attribute header and CRCs to check for corruption.

A flame graph analysis showed that we were spending 7% of a xfs_scrub
run (the whole program, not just the attr scrubber itself) allocating
and zeroing 64k segments needlessly.

Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Reviewed-by: Brian Foster &lt;bfoster@redhat.com&gt;
</content>
</entry>
<entry>
<title>xfs: only allocate memory for scrubbing attributes when we need it</title>
<updated>2019-07-05T17:29:56+00:00</updated>
<author>
<name>Darrick J. Wong</name>
<email>darrick.wong@oracle.com</email>
</author>
<published>2019-07-05T17:29:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6d6ccedd76823c28115bd6925342ceb73bab6cd4'/>
<id>urn:sha1:6d6ccedd76823c28115bd6925342ceb73bab6cd4</id>
<content type='text'>
In examining a flame graph of time spent running xfs_scrub on various
filesystems, I noticed that we spent nearly 7% of the total runtime on
allocating a zeroed 65k buffer for every SCRUB_TYPE_XATTR invocation.
We do this even if none of the attribute values were anywhere near 64k
in size, even if there were no attribute blocks to check space on, and
even if it just turns out there are no attributes at all.

Therefore, rearrange the xattr buffer setup code to support reallocating
with a bigger buffer and redistribute the callers of that function so
that we only allocate memory just prior to needing it, and only allocate
as much as we need.  If we can't get memory with the ILOCK held we'll
bail out with EDEADLOCK which will allocate the maximum memory.

Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Reviewed-by: Brian Foster &lt;bfoster@redhat.com&gt;
</content>
</entry>
<entry>
<title>xfs: refactor attr scrub memory allocation function</title>
<updated>2019-07-05T17:29:55+00:00</updated>
<author>
<name>Darrick J. Wong</name>
<email>darrick.wong@oracle.com</email>
</author>
<published>2019-07-05T17:29:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=00816759337cd28bc5290a24dcb527fd9d30680e'/>
<id>urn:sha1:00816759337cd28bc5290a24dcb527fd9d30680e</id>
<content type='text'>
Move the code that allocates memory buffers for the extended attribute
scrub code into a separate function so we can reduce memory allocations
in the next patch.

Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Reviewed-by: Brian Foster &lt;bfoster@redhat.com&gt;
</content>
</entry>
<entry>
<title>xfs: refactor extended attribute buffer pointer functions</title>
<updated>2019-07-05T17:29:55+00:00</updated>
<author>
<name>Darrick J. Wong</name>
<email>darrick.wong@oracle.com</email>
</author>
<published>2019-07-05T17:29:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3addd248800c0d278900c064e54e611ae505c622'/>
<id>urn:sha1:3addd248800c0d278900c064e54e611ae505c622</id>
<content type='text'>
Replace the open-coded attribute buffer pointer calculations with helper
functions to make it more obvious what we're doing with our freeform
memory allocation w.r.t. either storing xattr values or computing btree
block free space.

Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Reviewed-by: Brian Foster &lt;bfoster@redhat.com&gt;
</content>
</entry>
<entry>
<title>xfs: attribute scrub should use seen_enough to pass error values</title>
<updated>2019-07-05T17:29:54+00:00</updated>
<author>
<name>Darrick J. Wong</name>
<email>darrick.wong@oracle.com</email>
</author>
<published>2019-07-05T17:29:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2c3b83d7ca6d73b9478afc86c89377c15a90b9ed'/>
<id>urn:sha1:2c3b83d7ca6d73b9478afc86c89377c15a90b9ed</id>
<content type='text'>
When we're iterating all the attributes using the built-in xattr
iterator, we can use the seen_enough variable to pass error codes back
to the main scrub function instead of flattening them into 0/1.  This
will be used in a more exciting fashion in upcoming patches.

Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Reviewed-by: Brian Foster &lt;bfoster@redhat.com&gt;
</content>
</entry>
<entry>
<title>xfs: create iterator error codes</title>
<updated>2019-07-02T16:40:05+00:00</updated>
<author>
<name>Darrick J. Wong</name>
<email>darrick.wong@oracle.com</email>
</author>
<published>2019-07-02T16:39:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5bb46e3e180d28c7ee6715f47c344be366a3fcc8'/>
<id>urn:sha1:5bb46e3e180d28c7ee6715f47c344be366a3fcc8</id>
<content type='text'>
Currently, xfs doesn't have generic error codes defined for "stop
iterating"; we just reuse the XFS_BTREE_QUERY_* return values.  This
looks a little weird if we're not actually iterating a btree index.
Before we start adding more iterators, we should create general
XFS_ITER_{CONTINUE,ABORT} return values and define the XFS_BTREE_QUERY_*
ones from that.

Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Reviewed-by: Brian Foster &lt;bfoster@redhat.com&gt;
</content>
</entry>
<entry>
<title>xfs: remove unused header files</title>
<updated>2019-06-29T02:30:43+00:00</updated>
<author>
<name>Eric Sandeen</name>
<email>sandeen@sandeen.net</email>
</author>
<published>2019-06-29T02:30:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=250d4b4c409778bc44577dfc59909935c92fd006'/>
<id>urn:sha1:250d4b4c409778bc44577dfc59909935c92fd006</id>
<content type='text'>
There are many, many xfs header files which are included but
unneeded (or included twice) in the xfs code, so remove them.

nb: xfs_linux.h includes about 9 headers for everyone, so those
explicit includes get removed by this.  I'm not sure what the
preference is, but if we wanted explicit includes everywhere,
a followup patch could remove those xfs_*.h includes from
xfs_linux.h and move them into the files that need them.
Or it could be left as-is.

Signed-off-by: Eric Sandeen &lt;sandeen@redhat.com&gt;
Reviewed-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
</content>
</entry>
<entry>
<title>xfs: remove unused flag arguments</title>
<updated>2019-06-12T16:00:00+00:00</updated>
<author>
<name>Eric Sandeen</name>
<email>sandeen@redhat.com</email>
</author>
<published>2019-06-12T16:00:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f5b999c03f4c178d151e79803a95f8482a26521e'/>
<id>urn:sha1:f5b999c03f4c178d151e79803a95f8482a26521e</id>
<content type='text'>
There are several functions which take a flag argument that is
only ever passed as "0," so remove these arguments.

Signed-off-by: Eric Sandeen &lt;sandeen@redhat.com&gt;
Reviewed-by: Brian Foster &lt;bfoster@redhat.com&gt;
Reviewed-by: Bill O'Donnell &lt;billodo@redhat.com&gt;
Reviewed-by: Allison Collins &lt;allison.henderson@oracle.com&gt;
Reviewed-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
</content>
</entry>
<entry>
<title>xfs: separate inode geometry</title>
<updated>2019-06-12T15:37:40+00:00</updated>
<author>
<name>Darrick J. Wong</name>
<email>darrick.wong@oracle.com</email>
</author>
<published>2019-06-05T18:19:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ef325959993edd53e3ce7c818b18f776ac0740a6'/>
<id>urn:sha1:ef325959993edd53e3ce7c818b18f776ac0740a6</id>
<content type='text'>
Separate the inode geometry information into a distinct structure.

Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
</content>
</entry>
</feed>
