|
@@ -369,6 +369,33 @@ int gfs2_jdesc_check(struct gfs2_jdesc *jd)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static int init_threads(struct gfs2_sbd *sdp)
|
|
|
+{
|
|
|
+ struct task_struct *p;
|
|
|
+ int error = 0;
|
|
|
+
|
|
|
+ p = kthread_run(gfs2_logd, sdp, "gfs2_logd");
|
|
|
+ if (IS_ERR(p)) {
|
|
|
+ error = PTR_ERR(p);
|
|
|
+ fs_err(sdp, "can't start logd thread: %d\n", error);
|
|
|
+ return error;
|
|
|
+ }
|
|
|
+ sdp->sd_logd_process = p;
|
|
|
+
|
|
|
+ p = kthread_run(gfs2_quotad, sdp, "gfs2_quotad");
|
|
|
+ if (IS_ERR(p)) {
|
|
|
+ error = PTR_ERR(p);
|
|
|
+ fs_err(sdp, "can't start quotad thread: %d\n", error);
|
|
|
+ goto fail;
|
|
|
+ }
|
|
|
+ sdp->sd_quotad_process = p;
|
|
|
+ return 0;
|
|
|
+
|
|
|
+fail:
|
|
|
+ kthread_stop(sdp->sd_logd_process);
|
|
|
+ return error;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* gfs2_make_fs_rw - Turn a Read-Only FS into a Read-Write one
|
|
|
* @sdp: the filesystem
|
|
@@ -384,10 +411,14 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
|
|
|
struct gfs2_log_header_host head;
|
|
|
int error;
|
|
|
|
|
|
- error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &t_gh);
|
|
|
+ error = init_threads(sdp);
|
|
|
if (error)
|
|
|
return error;
|
|
|
|
|
|
+ error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &t_gh);
|
|
|
+ if (error)
|
|
|
+ goto fail_threads;
|
|
|
+
|
|
|
j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
|
|
|
|
|
|
error = gfs2_find_jhead(sdp->sd_jdesc, &head);
|
|
@@ -417,7 +448,9 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
|
|
|
fail:
|
|
|
t_gh.gh_flags |= GL_NOCACHE;
|
|
|
gfs2_glock_dq_uninit(&t_gh);
|
|
|
-
|
|
|
+fail_threads:
|
|
|
+ kthread_stop(sdp->sd_quotad_process);
|
|
|
+ kthread_stop(sdp->sd_logd_process);
|
|
|
return error;
|
|
|
}
|
|
|
|
|
@@ -800,6 +833,9 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
|
|
|
struct gfs2_holder t_gh;
|
|
|
int error;
|
|
|
|
|
|
+ kthread_stop(sdp->sd_quotad_process);
|
|
|
+ kthread_stop(sdp->sd_logd_process);
|
|
|
+
|
|
|
flush_workqueue(gfs2_delete_workqueue);
|
|
|
gfs2_quota_sync(sdp->sd_vfs, 0);
|
|
|
gfs2_statfs_sync(sdp->sd_vfs, 0);
|
|
@@ -857,9 +893,6 @@ restart:
|
|
|
}
|
|
|
spin_unlock(&sdp->sd_jindex_spin);
|
|
|
|
|
|
- kthread_stop(sdp->sd_quotad_process);
|
|
|
- kthread_stop(sdp->sd_logd_process);
|
|
|
-
|
|
|
if (!(sb->s_flags & MS_RDONLY)) {
|
|
|
error = gfs2_make_fs_ro(sdp);
|
|
|
if (error)
|