<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/fs/ext2/dir.c, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-01-07T10:11:40+00:00</updated>
<entry>
<title>ext2: unbugger ext2_empty_dir()</title>
<updated>2023-01-07T10:11:40+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2022-11-26T03:17:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=67ffc6dc3002572fa2bd982d95736b08b3ee18e0'/>
<id>urn:sha1:67ffc6dc3002572fa2bd982d95736b08b3ee18e0</id>
<content type='text'>
commit 27e714c007e4ad01837bf0fac5c11913a38d7695 upstream.

In 27cfa258951a "ext2: fix fs corruption when trying to remove
a non-empty directory with IO error" a funny thing has happened:

-               page = ext2_get_page(inode, i, dir_has_error, &amp;page_addr);
+               page = ext2_get_page(inode, i, 0, &amp;page_addr);

 -               if (IS_ERR(page)) {
 -                       dir_has_error = 1;
 -                       continue;
 -               }
 +               if (IS_ERR(page))
 +                       goto not_empty;

And at not_empty: we hit ext2_put_page(page, page_addr), which does
put_page(page).  Which, unless I'm very mistaken, should oops
immediately when given ERR_PTR(-E...) as page.

OK, shit happens, insufficiently tested patches included.  But when
commit in question describes the fault-injection test that exercised
that particular failure exit...

Ow.

CC: stable@vger.kernel.org
Fixes: 27cfa258951a ("ext2: fix fs corruption when trying to remove a non-empty directory with IO error")
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ext2: Use a folio in ext2_get_page()</title>
<updated>2022-08-02T16:34:03+00:00</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2022-05-17T22:06:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=37ce0b319b287666e2133ca740b73089355fe498'/>
<id>urn:sha1:37ce0b319b287666e2133ca740b73089355fe498</id>
<content type='text'>
Remove a call to read_mapping_page().

Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>ext2: Remove check for PageError</title>
<updated>2022-06-29T12:51:06+00:00</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2022-05-17T22:12:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=750cd7d0e65f2f65c52932ea48b2702fee6ab7a7'/>
<id>urn:sha1:750cd7d0e65f2f65c52932ea48b2702fee6ab7a7</id>
<content type='text'>
If read_mapping_page() encounters an error, it returns an errno, not a
page with PageError set, so this test is not needed.

Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>ext2: fix fs corruption when trying to remove a non-empty directory with IO error</title>
<updated>2022-06-16T08:55:45+00:00</updated>
<author>
<name>Ye Bin</name>
<email>yebin10@huawei.com</email>
</author>
<published>2022-06-15T09:00:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=27cfa258951a465e3eae63ee1e715e902cd45578'/>
<id>urn:sha1:27cfa258951a465e3eae63ee1e715e902cd45578</id>
<content type='text'>
We got issue as follows:
[home]# mount  /dev/sdd  test
[home]# cd test
[test]# ls
dir1  lost+found
[test]# rmdir  dir1
ext2_empty_dir: inject fault
[test]# ls
lost+found
[test]# cd ..
[home]# umount test
[home]# fsck.ext2 -fn  /dev/sdd
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Inode 4065, i_size is 0, should be 1024.  Fix? no

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Unconnected directory inode 4065 (/???)
Connect to /lost+found? no

'..' in ... (4065) is / (2), should be &lt;The NULL inode&gt; (0).
Fix? no

Pass 4: Checking reference counts
Inode 2 ref count is 3, should be 4.  Fix? no

Inode 4065 ref count is 2, should be 3.  Fix? no

Pass 5: Checking group summary information

/dev/sdd: ********** WARNING: Filesystem still has errors **********

/dev/sdd: 14/128016 files (0.0% non-contiguous), 18477/512000 blocks

Reason is same with commit 7aab5c84a0f6. We can't assume directory
is empty when read directory entry failed.

Link: https://lore.kernel.org/r/20220615090010.1544152-1-yebin10@huawei.com
Signed-off-by: Ye Bin &lt;yebin10@huawei.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>fs/ext2: Avoid page_address on pages returned by ext2_get_page</title>
<updated>2021-07-16T10:36:51+00:00</updated>
<author>
<name>Javier Pello</name>
<email>javier.pello@urjc.es</email>
</author>
<published>2021-07-14T16:54:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=728d392f8a799f037812d0f2b254fb3b5e115fcf'/>
<id>urn:sha1:728d392f8a799f037812d0f2b254fb3b5e115fcf</id>
<content type='text'>
Commit 782b76d7abdf02b12c46ed6f1e9bf715569027f7 ("fs/ext2: Replace
kmap() with kmap_local_page()") replaced the kmap/kunmap calls in
ext2_get_page/ext2_put_page with kmap_local_page/kunmap_local for
efficiency reasons. As a necessary side change, the commit also
made ext2_get_page (and ext2_find_entry and ext2_dotdot) return
the mapping address along with the page itself, as it is required
for kunmap_local, and converted uses of page_address on such pages
to use the newly returned address instead. However, uses of
page_address on such pages were missed in ext2_check_page and
ext2_delete_entry, which triggers oopses if kmap_local_page happens
to return an address from high memory. Fix this now by converting
the remaining uses of page_address to use the right address, as
returned by kmap_local_page.

Link: https://lore.kernel.org/r/20210714185448.8707ac239e9f12b3a7f5b9f9@urjc.es
Reviewed-by: Ira Weiny &lt;ira.weiny@intel.com&gt;
Signed-off-by: Javier Pello &lt;javier.pello@urjc.es&gt;
Fixes: 782b76d7abdf ("fs/ext2: Replace kmap() with kmap_local_page()")
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>fs/ext2: Replace kmap() with kmap_local_page()</title>
<updated>2021-03-31T11:10:20+00:00</updated>
<author>
<name>Ira Weiny</name>
<email>ira.weiny@intel.com</email>
</author>
<published>2021-03-29T06:54:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=782b76d7abdf02b12c46ed6f1e9bf715569027f7'/>
<id>urn:sha1:782b76d7abdf02b12c46ed6f1e9bf715569027f7</id>
<content type='text'>
The k[un]map() calls in ext2_[get|put]_page() are localized to a single
thread.  kmap_local_page() is more efficient.

Replace the kmap/kunmap calls with kmap_local_page()/kunmap_local().
kunmap_local() requires the mapping address so return that address from
ext2_get_page() to be used in ext2_put_page().  This works well because
many of the callers need the address anyway so it is not bad to return
it along with the page.

In addition, kmap_local_page()/kunmap_local() require strict nesting
rules to be followed.

Document the new nesting requirements of ext2_get_page() and
ext2_put_page() as well as the relationship between ext2_get_page(),
ext2_find_entry(), and ext2_dotdot().

Adjust one ext2_put_page() call site in ext2_rename() to ensure the new
nesting requirements are met.

Finally, adjust code style for checkpatch.

To: Jan Kara &lt;jack@suse.com&gt;
Link: https://lore.kernel.org/r/20210329065402.3297092-3-ira.weiny@intel.com
Signed-off-by: Ira Weiny &lt;ira.weiny@intel.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>ext2: Match up ext2_put_page() with ext2_dotdot() and ext2_find_entry()</title>
<updated>2021-03-31T11:02:08+00:00</updated>
<author>
<name>Ira Weiny</name>
<email>ira.weiny@intel.com</email>
</author>
<published>2021-03-29T06:54:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e2ebb1230455985df6aa45835a451a5404eddd8d'/>
<id>urn:sha1:e2ebb1230455985df6aa45835a451a5404eddd8d</id>
<content type='text'>
ext2_dotdot() and ext2_find_entry() both require ext2_put_page() to be
called after successful return.  For some of the calls this
corresponding put was hidden in ext2_set_link and ext2_delete_entry().

Match up ext2_put_page() with ext2_dotdot() and ext2_find_entry() in the
functions which call them.  This makes the code easier to follow
regarding the get/put of the page.

Clean up comments to match new behavior.

To: Jan Kara &lt;jack@suse.com&gt;
Link: https://lore.kernel.org/r/20210329065402.3297092-2-ira.weiny@intel.com
Signed-off-by: Ira Weiny &lt;ira.weiny@intel.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>fs/ext2: Use ext2_put_page</title>
<updated>2020-11-13T10:19:30+00:00</updated>
<author>
<name>Ira Weiny</name>
<email>ira.weiny@intel.com</email>
</author>
<published>2020-11-12T17:42:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a6fbd0ab3d7a1a02e61733a80c22fb01c65819b9'/>
<id>urn:sha1:a6fbd0ab3d7a1a02e61733a80c22fb01c65819b9</id>
<content type='text'>
There are 3 places in namei.c where the equivalent of ext2_put_page() is
open coded on a page which was returned from the ext2_get_page() call
[through the use of ext2_find_entry() and ext2_dotdot()].

Move ext2_put_page() to ext2.h and use it in namei.c

Also add a comment regarding the proper way to release the page returned
from ext2_find_entry() and ext2_dotdot().

Link: https://lore.kernel.org/r/20201112174244.701325-1-ira.weiny@intel.com
Signed-off-by: Ira Weiny &lt;ira.weiny@intel.com&gt;

Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>ext2: ext2_find_entry() return -ENOENT if no entry found</title>
<updated>2020-07-09T06:14:00+00:00</updated>
<author>
<name>zhangyi (F)</name>
<email>yi.zhang@huawei.com</email>
</author>
<published>2020-06-08T03:40:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a43850a380ef56009ce721737b0c08984b663b99'/>
<id>urn:sha1:a43850a380ef56009ce721737b0c08984b663b99</id>
<content type='text'>
Almost all callers of ext2_find_entry() transform NULL return value to
-ENOENT, so just let ext2_find_entry() retuen -ENOENT instead of NULL
if no valid entry found, and also switch to check the return value of
ext2_inode_by_name() in ext2_lookup() and ext2_get_parent().

Link: https://lore.kernel.org/r/20200608034043.10451-2-yi.zhang@huawei.com
Signed-off-by: zhangyi (F) &lt;yi.zhang@huawei.com&gt;
Suggested-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>ext2: propagate errors up to ext2_find_entry()'s callers</title>
<updated>2020-07-09T06:14:00+00:00</updated>
<author>
<name>zhangyi (F)</name>
<email>yi.zhang@huawei.com</email>
</author>
<published>2020-06-08T03:40:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b4962091a54c8c332e4c6c211a86b7f6d6e1f759'/>
<id>urn:sha1:b4962091a54c8c332e4c6c211a86b7f6d6e1f759</id>
<content type='text'>
The same to commit &lt;36de928641ee4&gt; (ext4: propagate errors up to
ext4_find_entry()'s callers') in ext4, also return error instead of NULL
pointer in case of some error happens in ext2_find_entry() (e.g. -ENOMEM
or -EIO). This could avoid a negative dentry cache entry installed even
it failed to read directory block due to IO error.

Link: https://lore.kernel.org/r/20200608034043.10451-1-yi.zhang@huawei.com
Signed-off-by: zhangyi (F) &lt;yi.zhang@huawei.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
</feed>
