* [Cluster-devel] [PATCH] rgmanager: fix nfsrestart option to be effective
@ 2012-06-21 8:07 Fabio M. Di Nitto
2012-06-21 13:26 ` Lon Hohberger
0 siblings, 1 reply; 3+ messages in thread
From: Fabio M. Di Nitto @ 2012-06-21 8:07 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: "Fabio M. Di Nitto" <fdinitto@redhat.com>
The original patch e512a9ce367 was still racy in some conditions
as other rpc.* and nfs* processes were holding a lock on the filesystem.
stopping nfs in kernel is simply not enough in rhel5
this fixed version does stop nfs completely and re-instante nfs exports.
Resolves: rhbz#822066
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
rgmanager/src/resources/clusterfs.sh | 31 ++++++++++++++++++++-----------
rgmanager/src/resources/fs.sh | 31 ++++++++++++++++++++-----------
2 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
index 89b30a2..49eb724 100755
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -681,7 +681,10 @@ stopFilesystem() {
typeset -i max_tries=3 # how many times to try umount
typeset -i sleep_time=2 # time between each umount failure
typeset -i refs=0
- typeset nfsdthreads
+ typeset nfsexports=""
+ typeset nfsexp=""
+ typeset nfsopts=""
+ typeset nfsacl=""
typeset done=""
typeset umount_failed=""
typeset force_umount=""
@@ -804,16 +807,22 @@ stop: Could not match $OCF_RESKEY_device with a real device"
if [ "$OCF_RESKEY_nfsrestart" = "yes" ] || \
[ "$OCF_RESKEY_nfsrestart" = "1" ]; then
- if [ -f /proc/fs/nfsd/threads ]; then
- ocf_log warning "Restarting nfsd/nfslock"
- nfsdthreads="$(cat /proc/fs/nfsd/threads)"
- service nfslock stop
- echo 0 > /proc/fs/nfsd/threads
- echo $nfsdthreads > /proc/fs/nfsd/threads
- service nfslock start
- else
- ocf_log err "Unable to determin nfsd information. nfsd restart aborted"
- fi
+ ocf_log warning "Restarting nfsd/nfslock"
+ nfsexports=$(cat /var/lib/nfs/etab)
+ service nfslock stop
+ service nfs stop
+ service nfs start
+ service nfslock start
+ echo "$nfsexports" | { while read line; do
+ nfsexp=$(echo $line | awk '{print $1}')
+ nfsopts=$(echo $line | sed -e 's#.*(##g' -e 's#).*##g')
+ nfsacl=$(echo $line | awk '{print $2}' | sed -e 's#(.*##g')
+ if [ -n "$nfsopts" ]; then
+ exportfs -i -o "$nfsopts" "$nfsacl":$nfsexp
+ else
+ exportfs -i "$nfsacl":$nfsexp
+ fi
+ done; }
fi
else
diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh
index 5724352..a98cddc 100755
--- a/rgmanager/src/resources/fs.sh
+++ b/rgmanager/src/resources/fs.sh
@@ -1019,7 +1019,10 @@ stopFilesystem() {
typeset -i max_tries=3 # how many times to try umount
typeset -i sleep_time=5 # time between each umount failure
typeset -i nfslock_reclaim=0
- typeset nfsdthreads
+ typeset nfsexports=""
+ typeset nfsexp=""
+ typeset nfsopts=""
+ typeset nfsacl=""
typeset done=""
typeset umount_failed=""
typeset force_umount=""
@@ -1126,16 +1129,22 @@ stop: Could not match $OCF_RESKEY_device with a real device"
if [ "$OCF_RESKEY_nfsrestart" = "yes" ] || \
[ "$OCF_RESKEY_nfsrestart" = "1" ]; then
- if [ -f /proc/fs/nfsd/threads ]; then
- ocf_log warning "Restarting nfsd/nfslock"
- nfsdthreads="$(cat /proc/fs/nfsd/threads)"
- service nfslock stop
- echo 0 > /proc/fs/nfsd/threads
- echo $nfsdthreads > /proc/fs/nfsd/threads
- service nfslock start
- else
- ocf_log err "Unable to determin nfsd information. nfsd restart aborted"
- fi
+ ocf_log warning "Restarting nfsd/nfslock"
+ nfsexports=$(cat /var/lib/nfs/etab)
+ service nfslock stop
+ service nfs stop
+ service nfs start
+ service nfslock start
+ echo "$nfsexports" | { while read line; do
+ nfsexp=$(echo $line | awk '{print $1}')
+ nfsopts=$(echo $line | sed -e 's#.*(##g' -e 's#).*##g')
+ nfsacl=$(echo $line | awk '{print $2}' | sed -e 's#(.*##g')
+ if [ -n "$nfsopts" ]; then
+ exportfs -i -o "$nfsopts" "$nfsacl":$nfsexp
+ else
+ exportfs -i "$nfsacl":$nfsexp
+ fi
+ done; }
fi
else
fuser -kvm "$mp"
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] rgmanager: fix nfsrestart option to be effective
2012-06-21 8:07 [Cluster-devel] [PATCH] rgmanager: fix nfsrestart option to be effective Fabio M. Di Nitto
@ 2012-06-21 13:26 ` Lon Hohberger
2012-06-21 13:29 ` Fabio M. Di Nitto
0 siblings, 1 reply; 3+ messages in thread
From: Lon Hohberger @ 2012-06-21 13:26 UTC (permalink / raw)
To: cluster-devel.redhat.com
On 06/21/2012 04:07 AM, Fabio M. Di Nitto wrote:
> From: "Fabio M. Di Nitto"<fdinitto@redhat.com>
>
> The original patch e512a9ce367 was still racy in some conditions
> as other rpc.* and nfs* processes were holding a lock on the filesystem.
>
> stopping nfs in kernel is simply not enough in rhel5
>
> this fixed version does stop nfs completely and re-instante nfs exports.
>
> Resolves: rhbz#822066
This is okay; ideally we wouldn't have to do this in the first place,
however.
-- Lon
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] rgmanager: fix nfsrestart option to be effective
2012-06-21 13:26 ` Lon Hohberger
@ 2012-06-21 13:29 ` Fabio M. Di Nitto
0 siblings, 0 replies; 3+ messages in thread
From: Fabio M. Di Nitto @ 2012-06-21 13:29 UTC (permalink / raw)
To: cluster-devel.redhat.com
On 6/21/2012 3:26 PM, Lon Hohberger wrote:
> On 06/21/2012 04:07 AM, Fabio M. Di Nitto wrote:
>> From: "Fabio M. Di Nitto"<fdinitto@redhat.com>
>>
>> The original patch e512a9ce367 was still racy in some conditions
>> as other rpc.* and nfs* processes were holding a lock on the filesystem.
>>
>> stopping nfs in kernel is simply not enough in rhel5
>>
>> this fixed version does stop nfs completely and re-instante nfs exports.
>>
>> Resolves: rhbz#822066
>
> This is okay; ideally we wouldn't have to do this in the first place,
> however.
and I would like some ponies, rainbows and unicorns...... however.
Fabio
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-21 13:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-21 8:07 [Cluster-devel] [PATCH] rgmanager: fix nfsrestart option to be effective Fabio M. Di Nitto
2012-06-21 13:26 ` Lon Hohberger
2012-06-21 13:29 ` Fabio M. Di Nitto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).