diff options
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r-- | fs/gfs2/sys.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 894bf773ec93..9f6d48b75fd2 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -356,34 +356,33 @@ static ssize_t first_done_show(struct gfs2_sbd *sdp, char *buf) | |||
356 | return sprintf(buf, "%d\n", ls->ls_first_done); | 356 | return sprintf(buf, "%d\n", ls->ls_first_done); |
357 | } | 357 | } |
358 | 358 | ||
359 | static ssize_t recover_show(struct gfs2_sbd *sdp, char *buf) | 359 | static ssize_t recover_store(struct gfs2_sbd *sdp, const char *buf, size_t len) |
360 | { | ||
361 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; | ||
362 | return sprintf(buf, "%d\n", ls->ls_recover_jid); | ||
363 | } | ||
364 | |||
365 | static void gfs2_jdesc_make_dirty(struct gfs2_sbd *sdp, unsigned int jid) | ||
366 | { | 360 | { |
361 | unsigned jid; | ||
367 | struct gfs2_jdesc *jd; | 362 | struct gfs2_jdesc *jd; |
363 | int rv; | ||
364 | |||
365 | rv = sscanf(buf, "%u", &jid); | ||
366 | if (rv != 1) | ||
367 | return -EINVAL; | ||
368 | 368 | ||
369 | rv = -ESHUTDOWN; | ||
369 | spin_lock(&sdp->sd_jindex_spin); | 370 | spin_lock(&sdp->sd_jindex_spin); |
371 | if (test_bit(SDF_NORECOVERY, &sdp->sd_flags)) | ||
372 | goto out; | ||
373 | rv = -EBUSY; | ||
374 | if (sdp->sd_jdesc->jd_jid == jid) | ||
375 | goto out; | ||
376 | rv = -ENOENT; | ||
370 | list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { | 377 | list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { |
371 | if (jd->jd_jid != jid) | 378 | if (jd->jd_jid != jid) |
372 | continue; | 379 | continue; |
373 | jd->jd_dirty = 1; | 380 | rv = slow_work_enqueue(&jd->jd_work); |
374 | break; | 381 | break; |
375 | } | 382 | } |
383 | out: | ||
376 | spin_unlock(&sdp->sd_jindex_spin); | 384 | spin_unlock(&sdp->sd_jindex_spin); |
377 | } | 385 | return rv ? rv : len; |
378 | |||
379 | static ssize_t recover_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | ||
380 | { | ||
381 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; | ||
382 | ls->ls_recover_jid = simple_strtol(buf, NULL, 0); | ||
383 | gfs2_jdesc_make_dirty(sdp, ls->ls_recover_jid); | ||
384 | if (sdp->sd_recoverd_process) | ||
385 | wake_up_process(sdp->sd_recoverd_process); | ||
386 | return len; | ||
387 | } | 386 | } |
388 | 387 | ||
389 | static ssize_t recover_done_show(struct gfs2_sbd *sdp, char *buf) | 388 | static ssize_t recover_done_show(struct gfs2_sbd *sdp, char *buf) |
@@ -401,15 +400,15 @@ static ssize_t recover_status_show(struct gfs2_sbd *sdp, char *buf) | |||
401 | #define GDLM_ATTR(_name,_mode,_show,_store) \ | 400 | #define GDLM_ATTR(_name,_mode,_show,_store) \ |
402 | static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) | 401 | static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) |
403 | 402 | ||
404 | GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); | 403 | GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); |
405 | GDLM_ATTR(block, 0644, block_show, block_store); | 404 | GDLM_ATTR(block, 0644, block_show, block_store); |
406 | GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); | 405 | GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); |
407 | GDLM_ATTR(id, 0444, lkid_show, NULL); | 406 | GDLM_ATTR(id, 0444, lkid_show, NULL); |
408 | GDLM_ATTR(first, 0444, lkfirst_show, NULL); | 407 | GDLM_ATTR(first, 0444, lkfirst_show, NULL); |
409 | GDLM_ATTR(first_done, 0444, first_done_show, NULL); | 408 | GDLM_ATTR(first_done, 0444, first_done_show, NULL); |
410 | GDLM_ATTR(recover, 0644, recover_show, recover_store); | 409 | GDLM_ATTR(recover, 0200, NULL, recover_store); |
411 | GDLM_ATTR(recover_done, 0444, recover_done_show, NULL); | 410 | GDLM_ATTR(recover_done, 0444, recover_done_show, NULL); |
412 | GDLM_ATTR(recover_status, 0444, recover_status_show, NULL); | 411 | GDLM_ATTR(recover_status, 0444, recover_status_show, NULL); |
413 | 412 | ||
414 | static struct attribute *lock_module_attrs[] = { | 413 | static struct attribute *lock_module_attrs[] = { |
415 | &gdlm_attr_proto_name.attr, | 414 | &gdlm_attr_proto_name.attr, |