2019-04-08 08:36:15

by Alexander Lochmann

[permalink] [raw]
Subject: [PATCH v3] Updated locking documentation for transaction_t

We used LockDoc to derive locking rules for each member
of struct transaction_t.
Based on those results, we extended the existing documentation
by more members of struct transaction_t, and updated the existing
documentation.

Signed-off-by: Alexander Lochmann <[email protected]>
Signed-off-by: Horst Schirmeier <[email protected]>
---
include/linux/jbd2.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 0f919d5fe84f..34b728e2b702 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -534,6 +534,7 @@ struct transaction_chp_stats_s {
* The transaction keeps track of all of the buffers modified by a
* running transaction, and all of the buffers committed but not yet
* flushed to home for finished transactions.
+ * (Locking Documentation improved by LockDoc)
*/

/*
@@ -652,12 +653,12 @@ struct transaction_s
unsigned long t_start;

/*
- * When commit was requested
+ * When commit was requested [journal_t.j_state_lock]
*/
unsigned long t_requested;

/*
- * Checkpointing stats [j_checkpoint_sem]
+ * Checkpointing stats [journal_t.j_list_lock]
*/
struct transaction_chp_stats_s t_chp_stats;

--
2.20.1


2021-03-17 21:01:30

by Alexander Lochmann

[permalink] [raw]
Subject: Re: [PATCH v3] Updated locking documentation for transaction_t

Does this patch look good to you either?

- Alex

On 11.02.21 18:14, Alexander Lochmann wrote:
> Some members of transaction_t are allowed to be read without
> any lock being held if accessed from the correct context.
> We used LockDoc's findings to determine those members.
> Each member of them is marked with a short comment:
> "no lock needed for jbd2 thread".
>
> Signed-off-by: Alexander Lochmann <[email protected]>
> Signed-off-by: Horst Schirmeier <[email protected]>
> Reviewed-by: Jan Kara <[email protected]>
> ---
> include/linux/jbd2.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
> index 99d3cd051ac3..1f19d19f6435 100644
> --- a/include/linux/jbd2.h
> +++ b/include/linux/jbd2.h
> @@ -594,18 +594,18 @@ struct transaction_s
> */
> unsigned long t_log_start;
>
> - /* Number of buffers on the t_buffers list [j_list_lock] */
> + /* Number of buffers on the t_buffers list [j_list_lock, no locks needed for jbd2 thread] */
> int t_nr_buffers;
>
> /*
> * Doubly-linked circular list of all buffers reserved but not yet
> - * modified by this transaction [j_list_lock]
> + * modified by this transaction [j_list_lock, no locks needed for jbd2 thread]
> */
> struct journal_head *t_reserved_list;
>
> /*
> * Doubly-linked circular list of all metadata buffers owned by this
> - * transaction [j_list_lock]
> + * transaction [j_list_lock, no locks needed for jbd2 thread]
> */
> struct journal_head *t_buffers;
>
> @@ -631,7 +631,7 @@ struct transaction_s
> /*
> * Doubly-linked circular list of metadata buffers being shadowed by log
> * IO. The IO buffers on the iobuf list and the shadow buffers on this
> - * list match each other one for one at all times. [j_list_lock]
> + * list match each other one for one at all times. [j_list_lock, no locks needed for jbd2 thread]
> */
> struct journal_head *t_shadow_list;
>
>

--
Technische Universität Dortmund
Alexander Lochmann PGP key: 0xBC3EF6FD
Otto-Hahn-Str. 16 phone: +49.231.7556141
D-44227 Dortmund fax: +49.231.7556116
http://ess.cs.tu-dortmund.de/Staff/al