projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0ee66dd
)
jbd2: don't read journal->j_commit_sequence without taking a lock
author
Harshad Shirwadkar
<harshadshirwadkar@gmail.com>
Fri, 6 Nov 2020 03:59:01 +0000
(19:59 -0800)
committer
Theodore Ts'o
<tytso@mit.edu>
Sat, 7 Nov 2020 04:01:04 +0000
(23:01 -0500)
Take journal state lock before reading journal->j_commit_sequence.
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Link:
https://lore.kernel.org/r/20201106035911.1942128-13-harshadshirwadkar@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/jbd2/journal.c
patch
|
blob
|
history
diff --git
a/fs/jbd2/journal.c
b/fs/jbd2/journal.c
index
b5fbcd1
..
f7ebf6e
100644
(file)
--- a/
fs/jbd2/journal.c
+++ b/
fs/jbd2/journal.c
@@
-734,10
+734,12
@@
int jbd2_fc_begin_commit(journal_t *journal, tid_t tid)
if (!journal->j_stats.ts_tid)
return -EINVAL;
- if (tid <= journal->j_commit_sequence)
+ write_lock(&journal->j_state_lock);
+ if (tid <= journal->j_commit_sequence) {
+ write_unlock(&journal->j_state_lock);
return -EALREADY;
+ }
- write_lock(&journal->j_state_lock);
if (journal->j_flags & JBD2_FULL_COMMIT_ONGOING ||
(journal->j_flags & JBD2_FAST_COMMIT_ONGOING)) {
DEFINE_WAIT(wait);