From 3ae9de44942a6cf28b7e1543e02e91dfe4e98f6f Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Wed, 13 Feb 2013 12:21:40 +0000 Subject: [PATCH] --- yaml --- r: 352955 b: refs/heads/master c: fd95e81cb1c74c9acd2356821faa9f24c2fec365 h: refs/heads/master i: 352953: 523801527209d595290b2ed917d99521bf99774c 352951: a06e78843b4666585e73128823b2439715b11f71 v: v3 --- [refs] | 2 +- trunk/fs/gfs2/incore.h | 1 + trunk/fs/gfs2/ops_fstype.c | 1 + trunk/fs/gfs2/sys.c | 24 +++++++++++++++++++++++- trunk/fs/gfs2/util.c | 3 +++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index c3d3aea19a85..759d0b92f5a0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d2b47cfb26fe06002b8011707baac71a9ae8166f +refs/heads/master: fd95e81cb1c74c9acd2356821faa9f24c2fec365 diff --git a/trunk/fs/gfs2/incore.h b/trunk/fs/gfs2/incore.h index 1533cf8b4269..e2601ba38ef5 100644 --- a/trunk/fs/gfs2/incore.h +++ b/trunk/fs/gfs2/incore.h @@ -642,6 +642,7 @@ struct gfs2_sbd { wait_queue_head_t sd_glock_wait; atomic_t sd_glock_disposal; struct completion sd_locking_init; + struct completion sd_wdack; struct delayed_work sd_control_work; /* Inode Stuff */ diff --git a/trunk/fs/gfs2/ops_fstype.c b/trunk/fs/gfs2/ops_fstype.c index e063f22d9e4c..1b612be4b873 100644 --- a/trunk/fs/gfs2/ops_fstype.c +++ b/trunk/fs/gfs2/ops_fstype.c @@ -81,6 +81,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) init_waitqueue_head(&sdp->sd_glock_wait); atomic_set(&sdp->sd_glock_disposal, 0); init_completion(&sdp->sd_locking_init); + init_completion(&sdp->sd_wdack); spin_lock_init(&sdp->sd_statfs_spin); spin_lock_init(&sdp->sd_rindex_spin); diff --git a/trunk/fs/gfs2/sys.c b/trunk/fs/gfs2/sys.c index 462e84142759..4fb9ad80d260 100644 --- a/trunk/fs/gfs2/sys.c +++ b/trunk/fs/gfs2/sys.c @@ -330,6 +330,28 @@ static ssize_t block_store(struct gfs2_sbd *sdp, const char *buf, size_t len) return ret; } +static ssize_t wdack_show(struct gfs2_sbd *sdp, char *buf) +{ + int val = completion_done(&sdp->sd_wdack) ? 1 : 0; + + return sprintf(buf, "%d\n", val); +} + +static ssize_t wdack_store(struct gfs2_sbd *sdp, const char *buf, size_t len) +{ + ssize_t ret = len; + int val; + + val = simple_strtol(buf, NULL, 0); + + if ((val == 1) && + !strcmp(sdp->sd_lockstruct.ls_ops->lm_proto_name, "lock_dlm")) + complete(&sdp->sd_wdack); + else + ret = -EINVAL; + return ret; +} + static ssize_t lkfirst_show(struct gfs2_sbd *sdp, char *buf) { struct lm_lockstruct *ls = &sdp->sd_lockstruct; @@ -461,7 +483,7 @@ static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); GDLM_ATTR(block, 0644, block_show, block_store); -GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); +GDLM_ATTR(withdraw, 0644, wdack_show, wdack_store); GDLM_ATTR(jid, 0644, jid_show, jid_store); GDLM_ATTR(first, 0644, lkfirst_show, lkfirst_store); GDLM_ATTR(first_done, 0444, first_done_show, NULL); diff --git a/trunk/fs/gfs2/util.c b/trunk/fs/gfs2/util.c index f00d7c5744f6..6402fb69d71b 100644 --- a/trunk/fs/gfs2/util.c +++ b/trunk/fs/gfs2/util.c @@ -54,6 +54,9 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...) kobject_uevent(&sdp->sd_kobj, KOBJ_OFFLINE); + if (!strcmp(sdp->sd_lockstruct.ls_ops->lm_proto_name, "lock_dlm")) + wait_for_completion(&sdp->sd_wdack); + if (lm->lm_unmount) { fs_err(sdp, "telling LM to unmount\n"); lm->lm_unmount(sdp);