<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/fs/btrfs, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/'/>
<entry>
<title>fs: btrfs: Add missing cache aligned allocation</title>
<updated>2021-05-26T21:26:07+00:00</updated>
<author>
<name>Marek Vasut</name>
<email>marex@denx.de</email>
</author>
<published>2021-05-17T22:39:39+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=9e8bb078859a559b17effdb21bafdb050b859b6e'/>
<id>9e8bb078859a559b17effdb21bafdb050b859b6e</id>
<content type='text'>
The superblock buffer must be cache aligned, since it might be used
in DMA context, allocate it using ALLOC_CACHE_ALIGN_BUFFER() just
like it was done in btrfs_read_superblock() and read_tree_node().

This fixes this output on boot and non-working btrfs on iMX53:
CACHE: Misaligned operation at range [ced299d0, ced2a9d0]

Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: Marek Behún &lt;marek.behun@nic.cz&gt;
Cc: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: Marek Behún &lt;marek.behun@nic.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The superblock buffer must be cache aligned, since it might be used
in DMA context, allocate it using ALLOC_CACHE_ALIGN_BUFFER() just
like it was done in btrfs_read_superblock() and read_tree_node().

This fixes this output on boot and non-working btrfs on iMX53:
CACHE: Misaligned operation at range [ced299d0, ced2a9d0]

Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: Marek Behún &lt;marek.behun@nic.cz&gt;
Cc: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: Marek Behún &lt;marek.behun@nic.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: fix the false alert of decompression failure</title>
<updated>2021-04-27T12:05:30+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>wqu@suse.com</email>
</author>
<published>2021-04-17T12:52:13+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=dae9aeda45277de24161d0f68f1a9468758f166e'/>
<id>dae9aeda45277de24161d0f68f1a9468758f166e</id>
<content type='text'>
There are some cases where decompressed sectors can have padding zeros.

In kernel code, we have lines to address such situation:

        /*
         * btrfs_getblock is doing a zero on the tail of the page too,
         * but this will cover anything missing from the decompressed
         * data.
         */
        if (bytes &lt; destlen)
                memset(kaddr+bytes, 0, destlen-bytes);
        kunmap_local(kaddr);

But not in U-boot code, thus we have some reports of U-boot failed to
read compressed files in btrfs.

Fix it by doing the same thing of the kernel, for both inline and
regular compressed extents.

Reported-by: Matwey Kornilov &lt;matwey.kornilov@gmail.com&gt;
Link: https://bugzilla.suse.com/show_bug.cgi?id=1183717
Fixes: a26a6bedafcf ("fs: btrfs: Introduce btrfs_read_extent_inline() and btrfs_read_extent_reg()")
Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are some cases where decompressed sectors can have padding zeros.

In kernel code, we have lines to address such situation:

        /*
         * btrfs_getblock is doing a zero on the tail of the page too,
         * but this will cover anything missing from the decompressed
         * data.
         */
        if (bytes &lt; destlen)
                memset(kaddr+bytes, 0, destlen-bytes);
        kunmap_local(kaddr);

But not in U-boot code, thus we have some reports of U-boot failed to
read compressed files in btrfs.

Fix it by doing the same thing of the kernel, for both inline and
regular compressed extents.

Reported-by: Matwey Kornilov &lt;matwey.kornilov@gmail.com&gt;
Link: https://bugzilla.suse.com/show_bug.cgi?id=1183717
Fixes: a26a6bedafcf ("fs: btrfs: Introduce btrfs_read_extent_inline() and btrfs_read_extent_reg()")
Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: do not fail when offset of a ROOT_ITEM is not -1</title>
<updated>2021-03-01T14:53:46+00:00</updated>
<author>
<name>Marek Behún</name>
<email>marek.behun@nic.cz</email>
</author>
<published>2021-02-09T17:33:37+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=1afb9f22220d11ebe13cd07431f8e649a65ead6d'/>
<id>1afb9f22220d11ebe13cd07431f8e649a65ead6d</id>
<content type='text'>
When the btrfs_read_fs_root() function is searching a ROOT_ITEM with
location key offset other than -1, it currently fails via BUG_ON.

The offset can have other value than -1, though. This can happen for
example if a subvolume is renamed:

  $ btrfs subvolume create X &amp;&amp; sync
  Create subvolume './X'
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: X$
        location key (270 ROOT_ITEM 18446744073709551615) type DIR
        transid 283 data_len 0 name_len 1
        name: X
  $ mv X Y &amp;&amp; sync
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: Y$
        location key (270 ROOT_ITEM 0) type DIR
        transid 285 data_len 0 name_len 1
        name: Y

As can be seen the offset changed from -1ULL to 0.

Do not fail in this case.

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Qu Wenruo &lt;wqu@suse.com&gt;
Cc: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the btrfs_read_fs_root() function is searching a ROOT_ITEM with
location key offset other than -1, it currently fails via BUG_ON.

The offset can have other value than -1, though. This can happen for
example if a subvolume is renamed:

  $ btrfs subvolume create X &amp;&amp; sync
  Create subvolume './X'
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: X$
        location key (270 ROOT_ITEM 18446744073709551615) type DIR
        transid 283 data_len 0 name_len 1
        name: X
  $ mv X Y &amp;&amp; sync
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: Y$
        location key (270 ROOT_ITEM 0) type DIR
        transid 285 data_len 0 name_len 1
        name: Y

As can be seen the offset changed from -1ULL to 0.

Do not fail in this case.

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Qu Wenruo &lt;wqu@suse.com&gt;
Cc: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: change directory list output to be aligned as before</title>
<updated>2021-02-24T21:51:48+00:00</updated>
<author>
<name>Marek Behún</name>
<email>marek.behun@nic.cz</email>
</author>
<published>2021-02-09T18:05:08+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=c65365d7add59b35a4fdde5807a7afb5503e7a40'/>
<id>c65365d7add59b35a4fdde5807a7afb5503e7a40</id>
<content type='text'>
Since commit 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to ...")
when btrfs is listing a directory, the output is not aligned:

  &lt;SYMLINK&gt;         15  Wed Sep 09 13:20:03 2020  boot.scr -&gt; @/boot/boot.scr
  &lt;DIR&gt;          0  Tue Feb 02 12:42:09 2021  @
  &lt;FILE&gt;        108  Tue Feb 02 12:54:04 2021  1.info

Return back to how it was displayed previously, i.e.:

  &lt;SYM&gt;         15  Wed Sep 09 13:20:03 2020  boot.scr -&gt; @/boot/boot.scr
  &lt;DIR&gt;          0  Tue Feb 02 12:42:09 2021  @
  &lt;   &gt;        108  Tue Feb 02 12:54:04 2021  1.info

Instead of '&lt;FILE&gt;', print '&lt;   &gt;', as ext4 driver.

If an unknown directory item type is encountered, we will print the type
number left padded with spaces, enclosed by '?', instead of '&lt;' and '&gt;',
i.e.:

  ? 30?        .............................  name

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Fixes: 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to replace ...")
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Qu Wenruo &lt;wqu@suse.com&gt;
Cc: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since commit 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to ...")
when btrfs is listing a directory, the output is not aligned:

  &lt;SYMLINK&gt;         15  Wed Sep 09 13:20:03 2020  boot.scr -&gt; @/boot/boot.scr
  &lt;DIR&gt;          0  Tue Feb 02 12:42:09 2021  @
  &lt;FILE&gt;        108  Tue Feb 02 12:54:04 2021  1.info

Return back to how it was displayed previously, i.e.:

  &lt;SYM&gt;         15  Wed Sep 09 13:20:03 2020  boot.scr -&gt; @/boot/boot.scr
  &lt;DIR&gt;          0  Tue Feb 02 12:42:09 2021  @
  &lt;   &gt;        108  Tue Feb 02 12:54:04 2021  1.info

Instead of '&lt;FILE&gt;', print '&lt;   &gt;', as ext4 driver.

If an unknown directory item type is encountered, we will print the type
number left padded with spaces, enclosed by '?', instead of '&lt;' and '&gt;',
i.e.:

  ? 30?        .............................  name

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Fixes: 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to replace ...")
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Qu Wenruo &lt;wqu@suse.com&gt;
Cc: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: skip xattrs in directory listing</title>
<updated>2021-02-24T21:51:48+00:00</updated>
<author>
<name>Marek Behún</name>
<email>marek.behun@nic.cz</email>
</author>
<published>2021-02-09T18:05:07+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=e4cecb56677c42077fae48928f9cd5ce18e8a3a2'/>
<id>e4cecb56677c42077fae48928f9cd5ce18e8a3a2</id>
<content type='text'>
Skip xattrs in directory listing. U-Boot filesystem drivers do not list
xattrs.

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Qu Wenruo &lt;wqu@suse.com&gt;
Cc: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Skip xattrs in directory listing. U-Boot filesystem drivers do not list
xattrs.

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Qu Wenruo &lt;wqu@suse.com&gt;
Cc: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: Select SHA256 in Kconfig</title>
<updated>2021-01-29T15:36:49+00:00</updated>
<author>
<name>Matthias Brugger</name>
<email>mbrugger@suse.com</email>
</author>
<published>2021-01-27T09:42:30+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=8921ac9747829d511954a946e3e8608818a4847a'/>
<id>8921ac9747829d511954a946e3e8608818a4847a</id>
<content type='text'>
Since commit 565a4147d17a ("fs: btrfs: Add more checksum algorithms")
btrfs uses the sha256 checksum algorithm. But Kconfig lacks to select
it. This leads to compilation errors:
fs/built-in.o: In function `hash_sha256':
fs/btrfs/crypto/hash.c:25: undefined reference to `sha256_starts'
fs/btrfs/crypto/hash.c:26: undefined reference to `sha256_update'
fs/btrfs/crypto/hash.c:27: undefined reference to `sha256_finish'

Signed-off-by: Matthias Brugger &lt;mbrugger@suse.com&gt;
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since commit 565a4147d17a ("fs: btrfs: Add more checksum algorithms")
btrfs uses the sha256 checksum algorithm. But Kconfig lacks to select
it. This leads to compilation errors:
fs/built-in.o: In function `hash_sha256':
fs/btrfs/crypto/hash.c:25: undefined reference to `sha256_starts'
fs/btrfs/crypto/hash.c:26: undefined reference to `sha256_update'
fs/btrfs/crypto/hash.c:27: undefined reference to `sha256_finish'

Signed-off-by: Matthias Brugger &lt;mbrugger@suse.com&gt;
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: simplify close_ctree_fs_info()</title>
<updated>2021-01-20T19:01:45+00:00</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>xypron.glpk@gmx.de</email>
</author>
<published>2020-12-25T12:45:25+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=3b00a6bafc726a9a9df45346fb734d9ecef7b428'/>
<id>3b00a6bafc726a9a9df45346fb734d9ecef7b428</id>
<content type='text'>
At the beginning of close_ctree_fs_info() the value 0 is assigned to err
and never changed before testing it.

Let's get rid of the superfluous variable.

Fixes: f06bfcf54d0e ("fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs")
Signed-off-by: Heinrich Schuchardt &lt;xypron.glpk@gmx.de&gt;
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
At the beginning of close_ctree_fs_info() the value 0 is assigned to err
and never changed before testing it.

Let's get rid of the superfluous variable.

Fixes: f06bfcf54d0e ("fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs")
Signed-off-by: Heinrich Schuchardt &lt;xypron.glpk@gmx.de&gt;
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: volumes: prevent overflow for multiplying</title>
<updated>2021-01-20T19:01:08+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>wqu@suse.com</email>
</author>
<published>2020-10-31T01:07:50+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=3b72612ad191cad29aad3982221ff3355bec798d'/>
<id>3b72612ad191cad29aad3982221ff3355bec798d</id>
<content type='text'>
In __btrfs_map_block() we do a int * int and assign it to u64.
This is not safe as the result (int * int) is still evaluated as (int)
thus it can overflow.

Convert one of the multiplier to u64 to prevent such problem.

In real world, this should not cause problem as we have device number
limit thus it won't go beyond 4G for a single stripe.

But it's harder to teach coverity about all these hidden limits, so just
fix the possible overflow.

Reported-by: Coverity CID 312957
Reported-by: Coverity CID 312948
Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In __btrfs_map_block() we do a int * int and assign it to u64.
This is not safe as the result (int * int) is still evaluated as (int)
thus it can overflow.

Convert one of the multiplier to u64 to prevent such problem.

In real world, this should not cause problem as we have device number
limit thus it won't go beyond 4G for a single stripe.

But it's harder to teach coverity about all these hidden limits, so just
fix the possible overflow.

Reported-by: Coverity CID 312957
Reported-by: Coverity CID 312948
Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: initialize @ret to 0 to prevent uninitialized return value</title>
<updated>2020-11-19T14:45:49+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>wqu@suse.com</email>
</author>
<published>2020-10-31T01:07:51+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=4891c4e595b48ee41b7d8062bb599d05a938ea0a'/>
<id>4891c4e595b48ee41b7d8062bb599d05a938ea0a</id>
<content type='text'>
In show_dir() if we hit a ROOT_ITEM, we can exit with uninitialized
@ret.

Fix it by initializing it to 0.

Reported-by: Coverity CID 312955
Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: Marek Behún &lt;marek.behun@nic.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In show_dir() if we hit a ROOT_ITEM, we can exit with uninitialized
@ret.

Fix it by initializing it to 0.

Reported-by: Coverity CID 312955
Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: Marek Behún &lt;marek.behun@nic.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: btrfs: inode: handle uninitialized type before returning it</title>
<updated>2020-11-19T14:45:49+00:00</updated>
<author>
<name>Qu Wenruo</name>
<email>wqu@suse.com</email>
</author>
<published>2020-10-31T01:07:49+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ausil/public_git/u-boot.git/commit/?id=9b5546c37ab020039f06855eae28fbd56adb096b'/>
<id>9b5546c37ab020039f06855eae28fbd56adb096b</id>
<content type='text'>
In btrfs_lookup_path() the local variable @type should always be updated
after we hit any file/dir.

But if @filename is NULL from the very beginning, then we don't
initialize it and return it directly.

To prevent such problem from happening, we initialize @type to
BTRFS_FT_UNKNOWN.
For normal execution route, it will get updated for each filename we
resolved.
Buf if we didn't find any path, we check if the type is still FT_UNKNOWN
and ret == 0. If true we know there is something wrong, just return
-EUCLEAN to inform the caller.

Reported-by: Coverity CID 312958
Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: Marek Behún &lt;marek.behun@nic.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In btrfs_lookup_path() the local variable @type should always be updated
after we hit any file/dir.

But if @filename is NULL from the very beginning, then we don't
initialize it and return it directly.

To prevent such problem from happening, we initialize @type to
BTRFS_FT_UNKNOWN.
For normal execution route, it will get updated for each filename we
resolved.
Buf if we didn't find any path, we check if the type is still FT_UNKNOWN
and ret == 0. If true we know there is something wrong, just return
-EUCLEAN to inform the caller.

Reported-by: Coverity CID 312958
Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: Marek Behún &lt;marek.behun@nic.cz&gt;
</pre>
</div>
</content>
</entry>
</feed>
