Re: [PATCH] mount: enable retry for nfs23 to set the correct protocol for mount.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday July 16, SteveD@xxxxxxxxxx wrote:
> >>  Enable retry if the mount call returns EIO, as that is what happens
> >>    if the UDP requests to portmap get no response.
> > 
> > I would rather see this one addressed in the kernel.  I think the EIO
> > return is a kernel bug.  If the server doesn't support a particular
> > transport protocol for portmap, mountd, or NFS, the mount(2) system
> > call should always return EPROTONOSUPPORT.
> Since EIO has so many meanings... I think it should stay as a fatal 
> error as well...
> 

That would be best.  But the reality is that there are kernels in the
wild where -EIO indicates and error that isn't really fatal.

We already do kernel-detection in mount.  How about extending it like
this?

Thanks,
NeilBrown

From: Neil Brown <neilb@xxxxxxx>
Date: Thu, 17 Jul 2008 12:23:03 +1000
Subject: [PATCH] mount: Recognised EIO from early kernels as possibly indicating a protocol error.

In kernels up to and including 2.6.26, mount reports "connection
refused" type messages as EIO rather than EPROTONOSUPPORT.
So detect those kernels and don't treat EIO as so fatal.

Signed-off-by: Neil Brown <neilb@xxxxxxx>
---
 utils/mount/mount.c   |    8 +++++++-
 utils/mount/stropts.c |    7 +++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index 06e2804..2163e4e 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -174,9 +174,15 @@ static void discover_nfs_mount_data_version(void)
 	}
 	if (nfs_mount_data_version > NFS_MOUNT_VERSION)
 		nfs_mount_data_version = NFS_MOUNT_VERSION;
-	else
+	else {
 		if (kernel_version > MAKE_VERSION(2, 6, 22))
 			string++;
+		/* up to and including 2.6.26, mount might return EIO
+		 * when it means EPROTONOSUPPORT
+		 */
+		if (kernel_version > MAKE_VERSION(2, 6, 26))
+			string++;
+	}
 }
 
 static void print_one(char *spec, char *node, char *type, char *opts)
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 09fca86..df4d9c1 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -552,9 +552,12 @@ static int nfs_try_nfs23mount(struct nfsmount_info *mi)
 
 	/*
 	 * The kernel returns EOPNOTSUPP if the RPC bind failed,
-	 * and EPROTONOSUPPORT if the version isn't supported.
+	 * and EPROTONOSUPPORT if the version isn't supported,
+	 * or the protocol isn't accepted.
+	 * Up to 2.6.26, the later causes EIO.
 	 */
-	if (errno != EOPNOTSUPP && errno != EPROTONOSUPPORT)
+	if (errno != EOPNOTSUPP && errno != EPROTONOSUPPORT &&
+	    (string >= 2 || errno != EIO))
 		return 0;
 
 	return nfs_retry_nfs23mount(mi);
-- 
1.5.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux