diff options
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r-- | fs/gfs2/sys.c | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index e6d8d482422f..597a612834dc 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -91,19 +91,15 @@ static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf) | |||
91 | 91 | ||
92 | static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf) | 92 | static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf) |
93 | { | 93 | { |
94 | unsigned int count; | 94 | struct super_block *sb = sdp->sd_vfs; |
95 | 95 | int frozen = (sb->s_writers.frozen == SB_UNFROZEN) ? 0 : 1; | |
96 | mutex_lock(&sdp->sd_freeze_lock); | ||
97 | count = sdp->sd_freeze_count; | ||
98 | mutex_unlock(&sdp->sd_freeze_lock); | ||
99 | 96 | ||
100 | return snprintf(buf, PAGE_SIZE, "%u\n", count); | 97 | return snprintf(buf, PAGE_SIZE, "%u\n", frozen); |
101 | } | 98 | } |
102 | 99 | ||
103 | static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | 100 | static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) |
104 | { | 101 | { |
105 | ssize_t ret = len; | 102 | int error; |
106 | int error = 0; | ||
107 | int n = simple_strtol(buf, NULL, 0); | 103 | int n = simple_strtol(buf, NULL, 0); |
108 | 104 | ||
109 | if (!capable(CAP_SYS_ADMIN)) | 105 | if (!capable(CAP_SYS_ADMIN)) |
@@ -111,19 +107,21 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | |||
111 | 107 | ||
112 | switch (n) { | 108 | switch (n) { |
113 | case 0: | 109 | case 0: |
114 | gfs2_unfreeze_fs(sdp); | 110 | error = thaw_super(sdp->sd_vfs); |
115 | break; | 111 | break; |
116 | case 1: | 112 | case 1: |
117 | error = gfs2_freeze_fs(sdp); | 113 | error = freeze_super(sdp->sd_vfs); |
118 | break; | 114 | break; |
119 | default: | 115 | default: |
120 | ret = -EINVAL; | 116 | return -EINVAL; |
121 | } | 117 | } |
122 | 118 | ||
123 | if (error) | 119 | if (error) { |
124 | fs_warn(sdp, "freeze %d error %d", n, error); | 120 | fs_warn(sdp, "freeze %d error %d", n, error); |
121 | return error; | ||
122 | } | ||
125 | 123 | ||
126 | return ret; | 124 | return len; |
127 | } | 125 | } |
128 | 126 | ||
129 | static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) | 127 | static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) |
@@ -342,6 +340,28 @@ static ssize_t block_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | |||
342 | return ret; | 340 | return ret; |
343 | } | 341 | } |
344 | 342 | ||
343 | static ssize_t wdack_show(struct gfs2_sbd *sdp, char *buf) | ||
344 | { | ||
345 | int val = completion_done(&sdp->sd_wdack) ? 1 : 0; | ||
346 | |||
347 | return sprintf(buf, "%d\n", val); | ||
348 | } | ||
349 | |||
350 | static ssize_t wdack_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | ||
351 | { | ||
352 | ssize_t ret = len; | ||
353 | int val; | ||
354 | |||
355 | val = simple_strtol(buf, NULL, 0); | ||
356 | |||
357 | if ((val == 1) && | ||
358 | !strcmp(sdp->sd_lockstruct.ls_ops->lm_proto_name, "lock_dlm")) | ||
359 | complete(&sdp->sd_wdack); | ||
360 | else | ||
361 | ret = -EINVAL; | ||
362 | return ret; | ||
363 | } | ||
364 | |||
345 | static ssize_t lkfirst_show(struct gfs2_sbd *sdp, char *buf) | 365 | static ssize_t lkfirst_show(struct gfs2_sbd *sdp, char *buf) |
346 | { | 366 | { |
347 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; | 367 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; |
@@ -473,7 +493,7 @@ static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) | |||
473 | 493 | ||
474 | GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); | 494 | GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); |
475 | GDLM_ATTR(block, 0644, block_show, block_store); | 495 | GDLM_ATTR(block, 0644, block_show, block_store); |
476 | GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); | 496 | GDLM_ATTR(withdraw, 0644, wdack_show, wdack_store); |
477 | GDLM_ATTR(jid, 0644, jid_show, jid_store); | 497 | GDLM_ATTR(jid, 0644, jid_show, jid_store); |
478 | GDLM_ATTR(first, 0644, lkfirst_show, lkfirst_store); | 498 | GDLM_ATTR(first, 0644, lkfirst_show, lkfirst_store); |
479 | GDLM_ATTR(first_done, 0444, first_done_show, NULL); | 499 | GDLM_ATTR(first_done, 0444, first_done_show, NULL); |