<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/gfs2/util.c, branch linux-5.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-06-18T08:02:49Z</updated>
<entry>
<title>gfs2: Clean up revokes on normal withdraws</title>
<updated>2021-06-18T08:02:49Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2021-05-19T18:54:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d27e9b57e710220d077052b449e13f53c9730a52'/>
<id>urn:sha1:d27e9b57e710220d077052b449e13f53c9730a52</id>
<content type='text'>
[ Upstream commit f5456b5d67cf812fd31fe3e130ca216b2e0908e5 ]

Before this patch, the system ail lists were cleaned up if the logd
process withdrew, but on other withdraws, they were not cleaned up.
This included the cleaning up of the revokes as well.

This patch reorganizes things a bit so that all withdraws (not just logd)
clean up the ail lists, including any pending revokes.

Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>gfs2: bypass signal_our_withdraw if no journal</title>
<updated>2021-03-12T13:55:23Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2021-03-12T12:58:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d5bf630f355d8c532bef2347cf90e8ae60a5f1bd'/>
<id>urn:sha1:d5bf630f355d8c532bef2347cf90e8ae60a5f1bd</id>
<content type='text'>
Before this patch, function signal_our_withdraw referenced the journal
inode immediately. But corrupt file systems may have some invalid
journals, in which case our attempt to read it in will withdraw and the
resulting signal_our_withdraw would dereference the NULL value.

This patch adds a check to signal_our_withdraw so that if the journal
has not yet been initialized, it simply returns and does the old-style
withdraw.

Thanks, Andy Price, for his analysis.

Reported-by: syzbot+50a8a9cf8127f2c6f5df@syzkaller.appspotmail.com
Fixes: 601ef0d52e96 ("gfs2: Force withdraw to replay journals and wait for it to finish")
Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: make function gfs2_make_fs_ro() to void type</title>
<updated>2021-03-07T16:04:55Z</updated>
<author>
<name>Yang Li</name>
</author>
<published>2021-03-04T14:28:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eb602521f43876b3f76c4686de596c9804977228'/>
<id>urn:sha1:eb602521f43876b3f76c4686de596c9804977228</id>
<content type='text'>
It fixes the following warning detected by coccinelle:
./fs/gfs2/super.c:592:5-10: Unneeded variable: "error". Return "0" on
line 628

Reported-by: Abaci Robot &lt;abaci@linux.alibaba.com&gt;
Signed-off-by: Yang Li &lt;yang.lee@linux.alibaba.com&gt;
Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: fix glock confusion in function signal_our_withdraw</title>
<updated>2021-01-25T13:08:44Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2021-01-18T20:18:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f5f02fde9f52b2d769c1c2ddfd3d9c4a1fe739a7'/>
<id>urn:sha1:f5f02fde9f52b2d769c1c2ddfd3d9c4a1fe739a7</id>
<content type='text'>
If go_free is defined, function signal_our_withdraw is supposed to
synchronize on the GLF_FREEING flag of the inode glock, but it
accidentally does that on the live glock. Fix that and disambiguate
the glock variables.

Fixes: 601ef0d52e96 ("gfs2: Force withdraw to replay journals and wait for it to finish")
Cc: stable@vger.kernel.org # v5.7+
Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: move freeze glock outside the make_fs_rw and _ro functions</title>
<updated>2020-12-22T23:54:21Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2020-12-22T20:43:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=96b1454f2e8ede4c619fde405a1bb4e9ba8d218e'/>
<id>urn:sha1:96b1454f2e8ede4c619fde405a1bb4e9ba8d218e</id>
<content type='text'>
Before this patch, sister functions gfs2_make_fs_rw and gfs2_make_fs_ro locked
(held) the freeze glock by calling gfs2_freeze_lock and gfs2_freeze_unlock.
The problem is, not all the callers of gfs2_make_fs_ro should be doing this.
The three callers of gfs2_make_fs_ro are: remount (gfs2_reconfigure),
signal_our_withdraw, and unmount (gfs2_put_super). But when unmounting the
file system we can get into the following circular lock dependency:

deactivate_super
   down_write(&amp;s-&gt;s_umount); &lt;-------------------------------------- s_umount
   deactivate_locked_super
      gfs2_kill_sb
         kill_block_super
            generic_shutdown_super
               gfs2_put_super
                  gfs2_make_fs_ro
                     gfs2_glock_nq_init sd_freeze_gl
                        freeze_go_sync
                           if (freeze glock in SH)
                              freeze_super (vfs)
                                 down_write(&amp;sb-&gt;s_umount); &lt;------- s_umount

This patch moves the hold of the freeze glock outside the two sister rw/ro
functions to their callers, but it doesn't request the glock from
gfs2_put_super, thus eliminating the circular dependency.

Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Add common helper for holding and releasing the freeze glock</title>
<updated>2020-12-22T23:54:13Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2020-12-22T20:43:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c77b52c0a137994ad796f44544c802b0b766e496'/>
<id>urn:sha1:c77b52c0a137994ad796f44544c802b0b766e496</id>
<content type='text'>
Many places in the gfs2 code queued and dequeued the freeze glock.
Almost all of them acquire it in SHARED mode, and need to specify the
same LM_FLAG_NOEXP and GL_EXACT flags.

This patch adds common helper functions gfs2_freeze_lock and gfs2_freeze_unlock
to make the code more readable, and to prepare for the next patch.

Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: in signal_our_withdraw wait for unfreeze of _this_ fs only</title>
<updated>2020-12-03T16:04:41Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2020-12-03T13:51:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6e5c4ea37a99e5b97aba227fc43f3682d4bc0496'/>
<id>urn:sha1:6e5c4ea37a99e5b97aba227fc43f3682d4bc0496</id>
<content type='text'>
Function signal_our_withdraw needs to work on file systems that have been
partially frozen. To do this, it called flush_workqueue(gfs2_freeze_wq).
This this wrong because it waits for *ALL* file systems to be unfrozen, not
just the one we're withdrawing from. It should only wait for the targetted
file system to be unfrozen. Otherwise it would wait until ALL file systems
are thawed before signaling the withdraw.

This patch changes signal_our_withdraw so it calls flush_work() for the target
file system's freeze work (only) to be completed.

Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump</title>
<updated>2020-10-14T21:54:43Z</updated>
<author>
<name>Andrew Price</name>
</author>
<published>2020-10-07T11:30:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e539ca1bbbe85a86549c97a30a765ada4a09df9'/>
<id>urn:sha1:0e539ca1bbbe85a86549c97a30a765ada4a09df9</id>
<content type='text'>
When an rindex entry is found to be corrupt, compute_bitstructs() calls
gfs2_consist_rgrpd() which calls gfs2_rgrp_dump() like this:

    gfs2_rgrp_dump(NULL, rgd-&gt;rd_gl, fs_id_buf);

gfs2_rgrp_dump then dereferences the gl without checking it and we get

    BUG: KASAN: null-ptr-deref in gfs2_rgrp_dump+0x28/0x280

because there's no rgrp glock involved while reading the rindex on mount.

Fix this by changing gfs2_rgrp_dump to take an rgrp argument.

Reported-by: syzbot+43fa87986bdd31df9de6@syzkaller.appspotmail.com
Signed-off-by: Andrew Price &lt;anprice@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: new slab for transactions</title>
<updated>2020-06-05T19:24:25Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2019-04-17T18:04:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b839dadae8721eaf7245fcef3d67d82b95d00c77'/>
<id>urn:sha1:b839dadae8721eaf7245fcef3d67d82b95d00c77</id>
<content type='text'>
This patch adds a new slab for gfs2 transactions. That allows us to
reduce kernel memory fragmentation, have better organization of data
for analysis of vmcore dumps. A new centralized function is added to
free the slab objects, and it exposes use-after-free by giving
warnings if a transaction is freed while it still has bd elements
attached to its buffers or ail lists. We make sure to initialize
those transaction ail lists so we can check their integrity when freeing.

At a later time, we should add a slab initialization function to
make it more efficient, but for this initial patch I wanted to
minimize the impact.

Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Fix BUG during unmount after file system withdraw</title>
<updated>2020-05-08T13:13:27Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2020-04-24T17:15:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=53af80ce0eaeb0fc4ce4b565c30e3a16e8e05de0'/>
<id>urn:sha1:53af80ce0eaeb0fc4ce4b565c30e3a16e8e05de0</id>
<content type='text'>
Before this patch, when the logd daemon was forced to withdraw, it
would try to request its journal be recovered by another cluster node.
However, in single-user cases with lock_nolock, there are no other
nodes to recover the journal. Function signal_our_withdraw() was
recognizing the lock_nolock situation, but not until after it had
evicted its journal inode. Since the journal descriptor that points
to the inode was never removed from the master list, when the unmount
occurred, it did another iput on the evicted inode, which resulted in
a BUG_ON(inode-&gt;i_state &amp; I_CLEAR).

This patch moves the check for this situation earlier in function
signal_our_withdraw(), which avoids the extra iput, so the unmount
may happen normally.

Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
</feed>
