Bug#714736: Handle svcgssd startup on clients based on NFSv4 minorversion mount option.
Quoted from http://thread.gmane.org/gmane.linux.nfs/45498/focus=45502:
> If you're using only v2, v3, or v4.1, that doesn't matter. (v2 and v3
> lack delegations, and v4.1 sends callbacks over existing
> client-established connections).
The attached patch improves Nicolas version for the cases of NFS version
!= 4.0, where svcgssd is not needed.
OTOH one it might be better to always run svcgssd to be sure NFS 4.0
delegations work and don't create NFS stalls.
diff -urN debian-4/nfs-common.init debian-4lhm1/nfs-common.init
--- debian-4/nfs-common.init 2013-05-11 14:38:17.000000000 +0200
+++ debian-4lhm1/nfs-common.init 2013-07-09 19:33:54.351669776 +0200
@@ -39,27 +50,58 @@
while read DEV MTPT FSTYPE OPTS REST
do
- case $DEV in
- ''|\#*)
- continue
- ;;
- esac
- # FSTYPE "nfs" can be NFSv4 now
- #if [ "$FSTYPE" = "nfs4" ]; then
- AUTO_NEED_IDMAPD=yes
- #fi
- case "$OPTS" in
-
- sec=krb5|*,sec=krb5|sec=krb5,*|*,sec=krb5i,*|sec=krb5i|*,sec=krb5i|sec=krb5i,*|*,sec=krb5i,*|sec=krb5p|*,sec=krb5p|sec=krb5p,*|*,sec=krb5p,*)
- AUTO_NEED_GSSD=yes
- ;;
+ case $DEV in
+ ''|\#*) continue ;;
+ esac
+
+ case $FSTYPE in
+ nfs|nfs4) : ;;
+ *) continue ;;
esac
+
+ # FSTYPE "nfs" can be NFSv4 now, so always start idmapd
+ AUTO_NEED_IDMAPD=yes
+
+ MOUNT_NEEDS_GSSD=no
+ MOUNT_NEEDS_SVCGSSD=yes
+
+ IFS_SAVE=$IFS
+ IFS=","
+ for OPT in $OPTS; do
+ if [[ $OPT =~ ^sec=(krb5[ip]?|sys)$ ]]; then
+ if [ "${BASH_REMATCH[1]}" = sys ]; then
+ MOUNT_NEEDS_GSSD=no
+ else
+ MOUNT_NEEDS_GSSD=yes
+ fi
+ else
+ # rpc.svcgssd is only necessary for NFS v4.0 delegations
+ # with Kerberos
+ if [[ $OPT =~ ^minorversion=(.*)$ ]]; then
+ if [ "${BASH_REMATCH[1]}" = 0 ]; then
+ MOUNT_NEEDS_SVCGSSD=yes
+ else
+ MOUNT_NEEDS_SVCGSSD=no
+ fi
+ fi
+ fi
+ done
+ IFS=${IFS_SAVE}
+
+ if [ "$MOUNT_NEEDS_GSSD" = yes ]; then
+ AUTO_NEED_GSSD=yes
+ if [ "$MOUNT_NEEDS_SVCGSSD" = yes ]; then
+ AUTO_NEED_SVCGSSD=yes
+ break
+ fi
+ fi
done
exec 0<&9 9<&-
Reply to: