Skip to content

Commit 1a9305d

Browse files
committed
gfs2: gfs2_freeze_lock_shared cleanup
jira LE-1907 Rebuild_History Non-Buildable kernel-4.18.0-477.27.1.el8_8 commit-author Andreas Gruenbacher <[email protected]> commit 6c7410f 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-4.18.0-477.27.1.el8_8/6c7410f4.failed All the remaining users of gfs2_freeze_lock_shared() set freeze_gh to &sdp->sd_freeze_gh and flags to 0, so remove those two parameters. Signed-off-by: Andreas Gruenbacher <[email protected]> (cherry picked from commit 6c7410f) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # fs/gfs2/ops_fstype.c # fs/gfs2/super.c
1 parent ccfd1ca commit 1a9305d

File tree

1 file changed

+200
-0
lines changed

1 file changed

+200
-0
lines changed
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
gfs2: gfs2_freeze_lock_shared cleanup
2+
3+
jira LE-1907
4+
Rebuild_History Non-Buildable kernel-4.18.0-477.27.1.el8_8
5+
commit-author Andreas Gruenbacher <[email protected]>
6+
commit 6c7410f44961cf72d49a18e455ad4ae833f6fb7c
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-4.18.0-477.27.1.el8_8/6c7410f4.failed
10+
11+
All the remaining users of gfs2_freeze_lock_shared() set freeze_gh to
12+
&sdp->sd_freeze_gh and flags to 0, so remove those two parameters.
13+
14+
Signed-off-by: Andreas Gruenbacher <[email protected]>
15+
(cherry picked from commit 6c7410f44961cf72d49a18e455ad4ae833f6fb7c)
16+
Signed-off-by: Jonathan Maple <[email protected]>
17+
18+
# Conflicts:
19+
# fs/gfs2/ops_fstype.c
20+
# fs/gfs2/super.c
21+
diff --cc fs/gfs2/ops_fstype.c
22+
index 698fc2257f73,9375409fd0c5..000000000000
23+
--- a/fs/gfs2/ops_fstype.c
24+
+++ b/fs/gfs2/ops_fstype.c
25+
@@@ -1244,7 -1267,7 +1244,11 @@@ static int gfs2_fill_super(struct super
26+
}
27+
}
28+
29+
++<<<<<<< HEAD
30+
+ error = gfs2_freeze_lock_shared(sdp, &freeze_gh, 0);
31+
++=======
32+
+ error = gfs2_freeze_lock_shared(sdp);
33+
++>>>>>>> 6c7410f44961 (gfs2: gfs2_freeze_lock_shared cleanup)
34+
if (error)
35+
goto fail_per_node;
36+
37+
diff --cc fs/gfs2/super.c
38+
index f0078c4bdb56,9f4d5d6549ee..000000000000
39+
--- a/fs/gfs2/super.c
40+
+++ b/fs/gfs2/super.c
41+
@@@ -389,8 -375,14 +389,19 @@@ static int gfs2_lock_fs_check_clean(str
42+
}
43+
}
44+
45+
++<<<<<<< HEAD
46+
+ if (error)
47+
+ gfs2_freeze_unlock(&sdp->sd_freeze_gh);
48+
++=======
49+
+ if (!error)
50+
+ goto out; /* success */
51+
+
52+
+ gfs2_freeze_unlock(&sdp->sd_freeze_gh);
53+
+
54+
+ relock_shared:
55+
+ error2 = gfs2_freeze_lock_shared(sdp);
56+
+ gfs2_assert_withdraw(sdp, !error2);
57+
++>>>>>>> 6c7410f44961 (gfs2: gfs2_freeze_lock_shared cleanup)
58+
59+
out:
60+
while (!list_empty(&list)) {
61+
@@@ -679,31 -684,75 +690,72 @@@ static int gfs2_sync_fs(struct super_bl
62+
return sdp->sd_log_error;
63+
}
64+
65+
++<<<<<<< HEAD
66+
++=======
67+
+ static int gfs2_freeze_locally(struct gfs2_sbd *sdp)
68+
+ {
69+
+ struct super_block *sb = sdp->sd_vfs;
70+
+ int error;
71+
+
72+
+ error = freeze_super(sb);
73+
+ if (error)
74+
+ return error;
75+
+
76+
+ if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
77+
+ gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_FREEZE |
78+
+ GFS2_LFC_FREEZE_GO_SYNC);
79+
+ if (gfs2_withdrawn(sdp)) {
80+
+ thaw_super(sb);
81+
+ return -EIO;
82+
+ }
83+
+ }
84+
+ return 0;
85+
+ }
86+
+
87+
+ static int gfs2_do_thaw(struct gfs2_sbd *sdp)
88+
+ {
89+
+ struct super_block *sb = sdp->sd_vfs;
90+
+ int error;
91+
+
92+
+ error = gfs2_freeze_lock_shared(sdp);
93+
+ if (error)
94+
+ goto fail;
95+
+ error = thaw_super(sb);
96+
+ if (!error)
97+
+ return 0;
98+
+
99+
+ fail:
100+
+ fs_info(sdp, "GFS2: couldn't thaw filesystem: %d\n", error);
101+
+ gfs2_assert_withdraw(sdp, 0);
102+
+ return error;
103+
+ }
104+
+
105+
++>>>>>>> 6c7410f44961 (gfs2: gfs2_freeze_lock_shared cleanup)
106+
void gfs2_freeze_func(struct work_struct *work)
107+
{
108+
+ int error;
109+
+ struct gfs2_holder freeze_gh;
110+
struct gfs2_sbd *sdp = container_of(work, struct gfs2_sbd, sd_freeze_work);
111+
struct super_block *sb = sdp->sd_vfs;
112+
- int error;
113+
-
114+
- mutex_lock(&sdp->sd_freeze_mutex);
115+
- error = -EBUSY;
116+
- if (test_bit(SDF_FROZEN, &sdp->sd_flags))
117+
- goto freeze_failed;
118+
-
119+
- error = gfs2_freeze_locally(sdp);
120+
- if (error)
121+
- goto freeze_failed;
122+
-
123+
- gfs2_freeze_unlock(&sdp->sd_freeze_gh);
124+
- set_bit(SDF_FROZEN, &sdp->sd_flags);
125+
-
126+
- error = gfs2_do_thaw(sdp);
127+
- if (error)
128+
- goto out;
129+
130+
- clear_bit(SDF_FROZEN, &sdp->sd_flags);
131+
- goto out;
132+
-
133+
-freeze_failed:
134+
- fs_info(sdp, "GFS2: couldn't freeze filesystem: %d\n", error);
135+
-
136+
-out:
137+
- mutex_unlock(&sdp->sd_freeze_mutex);
138+
+ atomic_inc(&sb->s_active);
139+
+ error = gfs2_freeze_lock_shared(sdp, &freeze_gh, 0);
140+
+ if (error) {
141+
+ gfs2_assert_withdraw(sdp, 0);
142+
+ } else {
143+
+ atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN);
144+
+ error = thaw_super(sb);
145+
+ if (error) {
146+
+ fs_info(sdp, "GFS2: couldn't thaw filesystem: %d\n",
147+
+ error);
148+
+ gfs2_assert_withdraw(sdp, 0);
149+
+ }
150+
+ gfs2_freeze_unlock(&freeze_gh);
151+
+ }
152+
deactivate_super(sb);
153+
+ clear_bit(SDF_FS_FROZEN, &sdp->sd_flags);
154+
+ wake_up_bit(&sdp->sd_flags, SDF_FS_FROZEN);
155+
+ return;
156+
}
157+
158+
/**
159+
* Unmerged path fs/gfs2/ops_fstype.c
160+
* Unmerged path fs/gfs2/super.c
161+
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
162+
index 8db57f0f2c81..e968aa77eb5f 100644
163+
--- a/fs/gfs2/util.c
164+
+++ b/fs/gfs2/util.c
165+
@@ -97,17 +97,14 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
166+
/**
167+
* gfs2_freeze_lock_shared - hold the freeze glock
168+
* @sdp: the superblock
169+
- * @freeze_gh: pointer to the requested holder
170+
- * @caller_flags: any additional flags needed by the caller
171+
*/
172+
-int gfs2_freeze_lock_shared(struct gfs2_sbd *sdp, struct gfs2_holder *freeze_gh,
173+
- int caller_flags)
174+
+int gfs2_freeze_lock_shared(struct gfs2_sbd *sdp)
175+
{
176+
- int flags = LM_FLAG_NOEXP | GL_EXACT | caller_flags;
177+
+ int flags = LM_FLAG_NOEXP | GL_EXACT;
178+
int error;
179+
180+
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, flags,
181+
- freeze_gh);
182+
+ &sdp->sd_freeze_gh);
183+
if (error && error != GLR_TRYFAILED)
184+
fs_err(sdp, "can't lock the freeze glock: %d\n", error);
185+
return error;
186+
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
187+
index a7e3e7b15f24..4d64fe579248 100644
188+
--- a/fs/gfs2/util.h
189+
+++ b/fs/gfs2/util.h
190+
@@ -152,9 +152,7 @@ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function,
191+
192+
extern int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
193+
bool verbose);
194+
-extern int gfs2_freeze_lock_shared(struct gfs2_sbd *sdp,
195+
- struct gfs2_holder *freeze_gh,
196+
- int caller_flags);
197+
+extern int gfs2_freeze_lock_shared(struct gfs2_sbd *sdp);
198+
extern void gfs2_freeze_unlock(struct gfs2_holder *freeze_gh);
199+
200+
#define gfs2_io_error(sdp) \

0 commit comments

Comments
 (0)