<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/gfs2/trans.c, branch linux-6.7.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-08-07T16:40:51Z</updated>
<entry>
<title>gfs2: Fix freeze consistency check in gfs2_trans_add_meta</title>
<updated>2023-08-07T16:40:51Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2023-08-04T20:17:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2cbd80642b76480c9b0697297af917d9388a0b46'/>
<id>urn:sha1:2cbd80642b76480c9b0697297af917d9388a0b46</id>
<content type='text'>
Function gfs2_trans_add_meta() checks for the SDF_FROZEN flag to make
sure that no buffers are added to a transaction while the filesystem is
frozen.  With the recent freeze/thaw rework, the SDF_FROZEN flag is
cleared after thaw_super() is called, which is sufficient for
serializing freeze/thaw.

However, other filesystem operations started after thaw_super() may now
be calling gfs2_trans_add_meta() before the SDF_FROZEN flag is cleared,
which will trigger the SDF_FROZEN check in gfs2_trans_add_meta().  Fix
that by checking the s_writers.frozen state instead.

In addition, make sure not to call gfs2_assert_withdraw() with the
sd_log_lock spin lock held.  Check for a withdrawn filesystem before
checking for a frozen filesystem, and don't pin/add buffers to the
current transaction in case of a failure in either case.

Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
Signed-off-by: Bob Peterson &lt;rpeterso@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Replace sd_freeze_state with SDF_FROZEN flag</title>
<updated>2023-07-03T20:30:23Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2022-08-18T14:12:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5432af15f8772d5e1a44d59d6ffcd513da8436b4'/>
<id>urn:sha1:5432af15f8772d5e1a44d59d6ffcd513da8436b4</id>
<content type='text'>
Replace sd_freeze_state with a new SDF_FROZEN flag.

There no longer is a need for indicating that a freeze is in progress
(SDF_STARTING_FREEZE); we are now protecting the critical sections with
the sd_freeze_mutex.

Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: fix use-after-free in trans_drain</title>
<updated>2021-03-07T16:04:55Z</updated>
<author>
<name>Bob Peterson</name>
</author>
<published>2021-02-25T16:11:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1a5a2cfd34c17db73c53ef127272c8c1ae220485'/>
<id>urn:sha1:1a5a2cfd34c17db73c53ef127272c8c1ae220485</id>
<content type='text'>
This patch adds code to function trans_drain to remove drained
bd elements from the ail lists, if queued, before freeing the bd.
If we don't remove the bd from the ail, function ail_drain will
try to reference the bd after it has been freed by trans_drain.

Thanks to Andy Price for his analysis of the problem.

Reported-by: Andy Price &lt;anprice@redhat.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: Per-revoke accounting in transactions</title>
<updated>2021-02-22T20:16:23Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2020-12-17T15:14:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2129b4288852cf872c42870c7f6e813ce0611199'/>
<id>urn:sha1:2129b4288852cf872c42870c7f6e813ce0611199</id>
<content type='text'>
In the log, revokes are stored as a revoke descriptor (struct
gfs2_log_descriptor), followed by zero or more additional revoke blocks
(struct gfs2_meta_header).  On filesystems with a blocksize of 4k, the
revoke descriptor contains up to 503 revokes, and the metadata blocks
contain up to 509 revokes each.  We've so far been reserving space for
revokes in transactions in block granularity, so a lot more space than
necessary was being allocated and then released again.

This patch switches to assigning revokes to transactions individually
instead.  Initially, space for the revoke descriptor is reserved and
handed out to transactions.  When more revokes than that are reserved,
additional revoke blocks are added.  When the log is flushed, the space
for the additional revoke blocks is released, but we keep the space for
the revoke descriptor block allocated.

Transactions may still reserve more revokes than they will actually need
in the end, but now we won't overshoot the target as much, and by only
returning the space for excess revokes at log flush time, we further
reduce the amount of contention between processes.

Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Rework the log space allocation logic</title>
<updated>2021-02-22T20:16:22Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2020-12-10T11:49:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fe3e397668775e20ad0962459733158838b926af'/>
<id>urn:sha1:fe3e397668775e20ad0962459733158838b926af</id>
<content type='text'>
The current log space allocation logic is hard to understand or extend.
The principle it that when the log is flushed, we may or may not have a
transaction active that has space allocated in the log.  To deal with
that, we set aside a magical number of blocks to be used in case we
don't have an active transaction.  It isn't clear that the pool will
always be big enough.  In addition, we can't return unused log space at
the end of a transaction, so the number of blocks allocated must exactly
match the number of blocks used.

Simplify this as follows:
 * When transactions are allocated or merged, always reserve enough
   blocks to flush the transaction (err on the safe side).
 * In gfs2_log_flush, return any allocated blocks that haven't been used.
 * Maintain a pool of spare blocks big enough to do one log flush, as
   before.
 * In gfs2_log_flush, when we have no active transaction, allocate a
   suitable number of blocks.  For that, use the spare pool when
   called from logd, and leave the pool alone otherwise.  This means
   that when the log is almost full, logd will still be able to do one
   more log flush, which will result in more log space becoming
   available.

This will make the log space allocator code easier to work with in
the future.

Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Use a tighter bound in gfs2_trans_begin</title>
<updated>2021-02-03T17:37:25Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2020-12-06T13:04:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=297de3180dd7ecbb3798f32e58691168587a8f85'/>
<id>urn:sha1:297de3180dd7ecbb3798f32e58691168587a8f85</id>
<content type='text'>
Use a tighter bound for the number of blocks required by transactions in
gfs2_trans_begin: in the worst case, we'll have mixed data and metadata,
so we'll need a log desciptor for each type.

Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Clean up gfs2_log_reserve</title>
<updated>2021-02-03T17:37:24Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2020-12-13T10:37:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5ae8fff8d031b5728f4c0e36e971bba42bb78bea'/>
<id>urn:sha1:5ae8fff8d031b5728f4c0e36e971bba42bb78bea</id>
<content type='text'>
Wake up log waiters in gfs2_log_release when log space has actually become
available.  This is a much better place for the wakeup than gfs2_logd.

Check if enough log space is immeditely available before anything else.  If
there isn't, use io_wait_event to wait instead of open-coding it.

Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Move lock flush locking to gfs2_trans_{begin,end}</title>
<updated>2021-02-03T17:37:24Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2020-12-12T22:30:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c1eba1b0bca59316f34aa6f70fe5004abba8082d'/>
<id>urn:sha1:c1eba1b0bca59316f34aa6f70fe5004abba8082d</id>
<content type='text'>
Move the read locking of sd_log_flush_lock from gfs2_log_reserve to
gfs2_trans_begin, and its unlocking from gfs2_log_release to
gfs2_trans_end.  Use gfs2_log_release in two places in which it was open
coded before.

Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Get rid of sd_reserving_log</title>
<updated>2021-02-03T17:37:24Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2020-12-13T08:21:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f3708fb59f6c2498e8ec4f29010375f600b68642'/>
<id>urn:sha1:f3708fb59f6c2498e8ec4f29010375f600b68642</id>
<content type='text'>
This counter and the associated wait queue are only used so that
gfs2_make_fs_ro can efficiently wait for all pending log space
allocations to fail after setting the filesystem to read-only.  This
comes at the cost of waking up that wait queue very frequently.

Instead, when gfs2_log_reserve fails because the filesystem has become
read-only, Wake up sd_log_waitq.  In gfs2_make_fs_ro, set the file
system read-only and then wait until all the log space has been
released.  Give up and report the problem after a while.  With that,
sd_reserving_log and sd_reserving_log_wait can be removed.

Signed-off-by: Andreas Gruenbacher &lt;agruenba@redhat.com&gt;
</content>
</entry>
<entry>
<title>gfs2: Clean up on-stack transactions</title>
<updated>2021-02-03T17:37:10Z</updated>
<author>
<name>Andreas Gruenbacher</name>
</author>
<published>2021-01-29T15:45:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c968f5788bc91fe4f86df1a68f0d6471396b4d78'/>
<id>urn:sha1:c968f5788bc91fe4f86df1a68f0d6471396b4d78</id>
<content type='text'>
Replace the TR_ALLOCED flag by its inverse, TR_ONSTACK: that way, the flag only
needs to be set in the exceptional case of on-stack transactions.  Split off
__gfs2_trans_begin from gfs2_trans_begin and use it to replace the open-coded
version in gfs2_ail_empty_gl.

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