Some old linux kernels return EPERM instead of ENOENT for nfsv4 file
authorChristos Zoulas <christos@zoulas.com>
Tue, 1 May 2012 16:23:50 +0000 (12:23 -0400)
committerChristos Zoulas <christos@zoulas.com>
Tue, 1 May 2012 16:23:50 +0000 (12:23 -0400)
handles. Fall back to nfsv3 for them too.

amd/ops_nfs.c

index 8b43722f7a3b00be1a75e88be6b828f6ade4b2ec..c82ee9057abf9e4f1978c151d0031d497fab5aa9 100644 (file)
@@ -924,8 +924,12 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
 
 #ifdef HAVE_FS_NFS4
 # ifndef NO_FALLBACK
-  /* NFS Version 4 has a different export list than v3, so try again with 3 */
-  if (error == ENOENT && nfs_version == NFS_VERSION4) {
+  /*
+   * If we are using a v4 file handle, we try a v3 if we get back:
+   *   ENOENT: NFS v4 has a different export list than v3
+   *   EPERM: Kernels <= 2.6.18 return that, instead of ENOENT
+   */
+  if ((error == ENOENT || error == EPERM) && nfs_version == NFS_VERSION4) {
     plog(XLOG_DEBUG, "Could not find NFS 4 mount, trying again with NFS 3");
     fs->fs_version = NFS_VERSION3;
     error = mount_nfs_fh(fhp, mntdir, fs_name, mf);