aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r--fs/gfs2/sys.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index ccacffd2faaa..64082a5feae1 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -399,31 +399,32 @@ static ssize_t recover_status_show(struct gfs2_sbd *sdp, char *buf)
399 399
400static ssize_t jid_show(struct gfs2_sbd *sdp, char *buf) 400static ssize_t jid_show(struct gfs2_sbd *sdp, char *buf)
401{ 401{
402 return sprintf(buf, "%u\n", sdp->sd_lockstruct.ls_jid); 402 return sprintf(buf, "%d\n", sdp->sd_lockstruct.ls_jid);
403} 403}
404 404
405static ssize_t jid_store(struct gfs2_sbd *sdp, const char *buf, size_t len) 405static ssize_t jid_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
406{ 406{
407 unsigned jid; 407 int jid;
408 int rv; 408 int rv;
409 409
410 rv = sscanf(buf, "%u", &jid); 410 rv = sscanf(buf, "%d", &jid);
411 if (rv != 1) 411 if (rv != 1)
412 return -EINVAL; 412 return -EINVAL;
413 413
414 spin_lock(&sdp->sd_jindex_spin); 414 spin_lock(&sdp->sd_jindex_spin);
415 rv = -EINVAL; 415 rv = -EINVAL;
416 if (sdp->sd_args.ar_spectator)
417 goto out;
418 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL) 416 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL)
419 goto out; 417 goto out;
420 rv = -EBUSY; 418 rv = -EBUSY;
421 if (test_and_clear_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0) 419 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0)
422 goto out; 420 goto out;
421 rv = 0;
422 if (sdp->sd_args.ar_spectator && jid > 0)
423 rv = jid = -EINVAL;
423 sdp->sd_lockstruct.ls_jid = jid; 424 sdp->sd_lockstruct.ls_jid = jid;
425 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags);
424 smp_mb__after_clear_bit(); 426 smp_mb__after_clear_bit();
425 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); 427 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID);
426 rv = 0;
427out: 428out:
428 spin_unlock(&sdp->sd_jindex_spin); 429 spin_unlock(&sdp->sd_jindex_spin);
429 return rv ? rv : len; 430 return rv ? rv : len;
@@ -617,7 +618,7 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
617 add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name); 618 add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
618 add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name); 619 add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
619 if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags)) 620 if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
620 add_uevent_var(env, "JOURNALID=%u", sdp->sd_lockstruct.ls_jid); 621 add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
621 if (gfs2_uuid_valid(uuid)) 622 if (gfs2_uuid_valid(uuid))
622 add_uevent_var(env, "UUID=%pUB", uuid); 623 add_uevent_var(env, "UUID=%pUB", uuid);
623 return 0; 624 return 0;