Skip to content

Commit 7de0fce

Browse files
committed
gfs2: Fix freeze consistency check in gfs2_trans_add_meta
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-4.18.0-477.27.1.rt7.290.el8_8 commit-author Andreas Gruenbacher <[email protected]> commit 2cbd806 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-rt-4.18.0-477.27.1.rt7.290.el8_8/2cbd8064.failed 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 <[email protected]> Signed-off-by: Bob Peterson <[email protected]> (cherry picked from commit 2cbd806) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # fs/gfs2/trans.c
1 parent 055ec93 commit 7de0fce

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
gfs2: Fix freeze consistency check in gfs2_trans_add_meta
2+
3+
jira LE-1907
4+
Rebuild_History Non-Buildable kernel-rt-4.18.0-477.27.1.rt7.290.el8_8
5+
commit-author Andreas Gruenbacher <[email protected]>
6+
commit 2cbd80642b76480c9b0697297af917d9388a0b46
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-rt-4.18.0-477.27.1.rt7.290.el8_8/2cbd8064.failed
10+
11+
Function gfs2_trans_add_meta() checks for the SDF_FROZEN flag to make
12+
sure that no buffers are added to a transaction while the filesystem is
13+
frozen. With the recent freeze/thaw rework, the SDF_FROZEN flag is
14+
cleared after thaw_super() is called, which is sufficient for
15+
serializing freeze/thaw.
16+
17+
However, other filesystem operations started after thaw_super() may now
18+
be calling gfs2_trans_add_meta() before the SDF_FROZEN flag is cleared,
19+
which will trigger the SDF_FROZEN check in gfs2_trans_add_meta(). Fix
20+
that by checking the s_writers.frozen state instead.
21+
22+
In addition, make sure not to call gfs2_assert_withdraw() with the
23+
sd_log_lock spin lock held. Check for a withdrawn filesystem before
24+
checking for a frozen filesystem, and don't pin/add buffers to the
25+
current transaction in case of a failure in either case.
26+
27+
Signed-off-by: Andreas Gruenbacher <[email protected]>
28+
Signed-off-by: Bob Peterson <[email protected]>
29+
(cherry picked from commit 2cbd80642b76480c9b0697297af917d9388a0b46)
30+
Signed-off-by: Jonathan Maple <[email protected]>
31+
32+
# Conflicts:
33+
# fs/gfs2/trans.c
34+
diff --cc fs/gfs2/trans.c
35+
index d4cda4f24672,7e835be7032d..000000000000
36+
--- a/fs/gfs2/trans.c
37+
+++ b/fs/gfs2/trans.c
38+
@@@ -236,7 -234,7 +237,11 @@@ void gfs2_trans_add_meta(struct gfs2_gl
39+
struct gfs2_bufdata *bd;
40+
struct gfs2_meta_header *mh;
41+
struct gfs2_trans *tr = current->journal_info;
42+
++<<<<<<< HEAD
43+
+ enum gfs2_freeze_state state = atomic_read(&sdp->sd_freeze_state);
44+
++=======
45+
+ bool withdraw = false;
46+
++>>>>>>> 2cbd80642b76 (gfs2: Fix freeze consistency check in gfs2_trans_add_meta)
47+
48+
lock_buffer(bh);
49+
if (buffer_pinned(bh)) {
50+
@@@ -270,10 -268,6 +275,13 @@@
51+
(unsigned long long)bd->bd_bh->b_blocknr);
52+
BUG();
53+
}
54+
++<<<<<<< HEAD
55+
+ if (unlikely(state == SFS_FROZEN)) {
56+
+ fs_info(sdp, "GFS2:adding buf while frozen\n");
57+
+ gfs2_assert_withdraw(sdp, 0);
58+
+ }
59+
++=======
60+
++>>>>>>> 2cbd80642b76 (gfs2: Fix freeze consistency check in gfs2_trans_add_meta)
61+
if (unlikely(gfs2_withdrawn(sdp))) {
62+
fs_info(sdp, "GFS2:adding buf while withdrawn! 0x%llx\n",
63+
(unsigned long long)bd->bd_bh->b_blocknr);
64+
* Unmerged path fs/gfs2/trans.c

0 commit comments

Comments
 (0)