Fix mount.nfs4 to display correct error message (bz 227212)
This commit is contained in:
parent
e6adf82338
commit
2d0657640a
86
nfs-utils-1.0.12-mount-v4-errors.patch
Normal file
86
nfs-utils-1.0.12-mount-v4-errors.patch
Normal file
@ -0,0 +1,86 @@
|
||||
commit 99defadcebf3bf892871f5541bfe762685faccbd
|
||||
Author: Steve Dickson <steved@redhat.com>
|
||||
Date: Wed May 9 13:14:26 2007 -0400
|
||||
|
||||
When nfs4 mount fail because the exported directory does
|
||||
not exist, the mount command claims the local mount point
|
||||
does not exist which is wrong. This patch fixes that problem
|
||||
as well as makes the v4 mount failures look like v3/v2 failures.
|
||||
|
||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||
|
||||
--- nfs-utils-1.0.12/utils/mount/mount.c.orig 2007-05-09 14:06:23.574929000 -0400
|
||||
+++ nfs-utils-1.0.12/utils/mount/mount.c 2007-05-09 14:07:34.368247000 -0400
|
||||
@@ -348,22 +348,49 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void mount_error(char *node)
|
||||
+static void mount_error(char *mntpnt, char *node)
|
||||
{
|
||||
switch(errno) {
|
||||
case ENOTDIR:
|
||||
- fprintf(stderr, "%s: mount point %s is not a directory\n", progname, node);
|
||||
+ fprintf(stderr, "%s: mount point %s is not a directory\n",
|
||||
+ progname, mntpnt);
|
||||
break;
|
||||
case EBUSY:
|
||||
- fprintf(stderr, "%s: %s is already mounted or busy\n", progname, node);
|
||||
+ fprintf(stderr, "%s: %s is already mounted or busy\n",
|
||||
+ progname, mntpnt);
|
||||
break;
|
||||
case ENOENT:
|
||||
- fprintf(stderr, "%s: mount point %s does not exist\n", progname, node);
|
||||
+ if (node) {
|
||||
+ fprintf(stderr, "%s: %s failed, reason given by server: %s\n",
|
||||
+ progname, node, strerror(errno));
|
||||
+ } else
|
||||
+ fprintf(stderr, "%s: mount point %s does not exist\n",
|
||||
+ progname, mntpnt);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: %s\n", progname, strerror(errno));
|
||||
}
|
||||
}
|
||||
+static int chk_mountpoint(mount_point)
|
||||
+{
|
||||
+ struct stat sb;
|
||||
+
|
||||
+ if (stat(mount_point, &sb) < 0){
|
||||
+ mount_error(mount_point, NULL);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (S_ISDIR(sb.st_mode) == 0){
|
||||
+ errno = ENOTDIR;
|
||||
+ mount_error(mount_point, NULL);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (access(mount_point, X_OK) < 0) {
|
||||
+ mount_error(mount_point, NULL);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
#define NFS_MOUNT_VERS_DEFAULT 3
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -493,6 +520,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (chk_mountpoint(mount_point))
|
||||
+ exit(EX_FAIL);
|
||||
+
|
||||
if (nfs_mount_vers == 4) {
|
||||
mnt_err = nfs4mount(spec, mount_point, &flags,
|
||||
&extra_opts, &mount_opts, 0);
|
||||
@@ -512,7 +542,7 @@
|
||||
flags, mount_opts);
|
||||
|
||||
if (mnt_err) {
|
||||
- mount_error(mount_point);
|
||||
+ mount_error(mount_point, spec);
|
||||
exit(EX_FAIL);
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
|
||||
Name: nfs-utils
|
||||
URL: http://sourceforge.net/projects/nfs
|
||||
Version: 1.0.12
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
# group all 32bit related archs
|
||||
@ -46,6 +46,7 @@ Patch78: nfs-utils-1.0.10-udp-no-connect.patch
|
||||
Patch79: nfs-utils-1.0.10-v4-umounts.patch
|
||||
Patch80: nfs-utils-1.0.9-mount-quotes.patch
|
||||
Patch81: nfs-utils-1.0.10-mount-fake.patch
|
||||
Patch82: nfs-utils-1.0.12-mount-v4-errors.patch
|
||||
|
||||
%if %{enablefscache}
|
||||
Patch90: nfs-utils-1.0.9-mount-fsc.patch
|
||||
@ -117,6 +118,7 @@ This package also contains the mount.nfs and umount.nfs program.
|
||||
%patch79 -p1
|
||||
%patch80 -p1
|
||||
%patch81 -p1
|
||||
%patch82 -p1
|
||||
%if %{enablefscache}
|
||||
%patch90 -p1
|
||||
%endif
|
||||
@ -292,6 +294,9 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed May 9 2007 Steve Dickson <steved@redhat.com> 1.0.10-18
|
||||
- Fix mount.nfs4 to display correct error message (bz 227212)
|
||||
|
||||
* Tue Apr 3 2007 Steve Dickson <steved@redhat.com> 1.0.12-4
|
||||
- Replace portmap dependency with an rpcbind dependency (bz 228894)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user