* [PATCH] NFS Client mounts hang when exported directory do not exist
@ 2008-04-11 16:05 Steve Dickson
0 siblings, 0 replies; 9+ messages in thread
From: Steve Dickson @ 2008-04-11 16:05 UTC (permalink / raw)
To: Linux NFS Mailing list; +Cc: Fedora Kernel Mailing list
This patch fixes a regression that was introduced by the string based mounts.
nfs_mount() statically returns -EACCES for every error returned
by the remote mounted. This is incorrect because -EACCES is
an non-fatal error to the mount.nfs command. This error causes
mount.nfs to retry the mount even in the case when the exported
directory does not exist.
This patch maps the errors returned by the remote mountd into
valid errno values, exactly how it was done pre-string based
mounts. By returning the correct errno enables mount.nfs
to do the right thing.
Signed-off-by: Steve Dickson <steved@redhat.com>
---
diff -up linux/fs/nfs/mount_clnt.c.orig linux/fs/nfs/mount_clnt.c
--- linux/fs/nfs/mount_clnt.c.orig 2008-04-09 08:32:43.000000000 -0400
+++ linux/fs/nfs/mount_clnt.c 2008-04-11 11:01:39.000000000 -0400
@@ -21,6 +21,49 @@
static struct rpc_program mnt_program;
+static struct {
+ enum nfs_stat stat;
+ int errnum;
+} mnt_errtbl[] = {
+ { NFS_OK, 0 },
+ { NFSERR_PERM, EPERM },
+ { NFSERR_NOENT, ENOENT },
+ { NFSERR_IO, EIO },
+ { NFSERR_NXIO, ENXIO },
+ { NFSERR_ACCES, EACCES },
+ { NFSERR_EXIST, EEXIST },
+ { NFSERR_NODEV, ENODEV },
+ { NFSERR_NOTDIR, ENOTDIR },
+ { NFSERR_ISDIR, EISDIR },
+#ifdef NFSERR_INVAL
+ { NFSERR_INVAL, EINVAL }, /* that Sun forgot */
+#endif
+ { NFSERR_FBIG, EFBIG },
+ { NFSERR_NOSPC, ENOSPC },
+ { NFSERR_ROFS, EROFS },
+ { NFSERR_NAMETOOLONG, ENAMETOOLONG },
+ { NFSERR_NOTEMPTY, ENOTEMPTY },
+ { NFSERR_DQUOT, EDQUOT },
+ { NFSERR_STALE, ESTALE },
+#ifdef EWFLUSH
+ { NFSERR_WFLUSH, EWFLUSH },
+#endif
+ /* Throw in some NFSv3 values for even more fun (HP returns these) */
+ { 71, EREMOTE },
+};
+static int mnt_errtbl_sz = sizeof(mnt_errtbl)/sizeof(mnt_errtbl[0]);
+
+static inline int mnt_err_map(int stat)
+{
+ int i;
+
+ for (i = 0; i < mnt_errtbl_sz; i++) {
+ if (mnt_errtbl[i].stat == stat)
+ return -mnt_errtbl[i].errnum;
+ }
+ return -EACCES;
+}
+
struct mnt_fhstatus {
u32 status;
struct nfs_fh *fh;
@@ -98,7 +141,7 @@ out_call_err:
out_mnt_err:
dprintk("NFS: MNT server returned result %d\n", result.status);
- status = -EACCES;
+ status = mnt_err_map(result.status);
goto out;
}
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH] NFS Client mounts hang when exported directory do not exist
@ 2008-04-12 0:03 Steve Dickson
0 siblings, 0 replies; 9+ messages in thread
From: Steve Dickson @ 2008-04-12 0:03 UTC (permalink / raw)
To: Linux NFS Mailing list; +Cc: Fedora Kernel Mailing list
This patch fixes a regression that was introduced by the string based mounts.
nfs_mount() statically returns -EACCES for every error returned
by the remote mounted. This is incorrect because -EACCES is
an non-fatal error to the mount.nfs command. This error causes
mount.nfs to retry the mount even in the case when the exported
directory does not exist.
This patch maps the errors returned by the remote mountd into
valid errno values, exactly how it was done pre-string based
mounts. By returning the correct errno enables mount.nfs
to do the right thing.
Signed-off-by: Steve Dickson <steved@redhat.com>
---
Take 2- Why reinvent the wheel, as Trond pointed out using
nfs_stat_to_errno() makes more sense and is makes things much
similar, something I'm always a fan of...
diff -up linux/fs/nfs/mount_clnt.c.orig linux/fs/nfs/mount_clnt.c
--- linux/fs/nfs/mount_clnt.c.orig 2008-04-09 08:32:43.000000000 -0400
+++ linux/fs/nfs/mount_clnt.c 2008-04-11 19:42:16.000000000 -0400
@@ -14,6 +14,7 @@
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/sched.h>
#include <linux/nfs_fs.h>
+#include "internal.h"
#ifdef RPC_DEBUG
# define NFSDBG_FACILITY NFSDBG_MOUNT
@@ -98,7 +99,7 @@ out_call_err:
out_mnt_err:
dprintk("NFS: MNT server returned result %d\n", result.status);
- status = -EACCES;
+ status = -nfs_stat_to_errno(result.status);
goto out;
}
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH] NFS Client mounts hang when exported directory do not exist
@ 2008-04-11 15:12 Steve Dickson
[not found] ` <47FF7FCC.2050403-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Steve Dickson @ 2008-04-11 15:12 UTC (permalink / raw)
To: Linux NFS Mailing list; +Cc: Fedora Kernel Mailing list
This patch fixes a regression that was introduced by the string based mounts.
nfs_mount() statically returns -EACCES for every error returned
by the remote mounted. This is incorrect because -EACCES is
an non-fatal error to the mount.nfs command. This error causes
mount.nfs to retry the mount even in the case when the exported
directory does not exist.
This patch maps the errors returned by the remote mountd into
valid errno values, exactly how it was done pre-string based
mounts. By returning the correct errno enables mount.nfs
to do the right thing.
Signed-off-by: Steve Dickson <steved@redhat.com>
---
diff -up linux/fs/nfs/mount_clnt.c.orig linux/fs/nfs/mount_clnt.c
--- linux/fs/nfs/mount_clnt.c.orig 2008-04-09 08:32:43.000000000 -0400
+++ linux/fs/nfs/mount_clnt.c 2008-04-11 11:01:39.000000000 -0400
@@ -21,6 +21,49 @@
static struct rpc_program mnt_program;
+static struct {
+ enum nfs_stat stat;
+ int errnum;
+} mnt_errtbl[] = {
+ { NFS_OK, 0 },
+ { NFSERR_PERM, EPERM },
+ { NFSERR_NOENT, ENOENT },
+ { NFSERR_IO, EIO },
+ { NFSERR_NXIO, ENXIO },
+ { NFSERR_ACCES, EACCES },
+ { NFSERR_EXIST, EEXIST },
+ { NFSERR_NODEV, ENODEV },
+ { NFSERR_NOTDIR, ENOTDIR },
+ { NFSERR_ISDIR, EISDIR },
+#ifdef NFSERR_INVAL
+ { NFSERR_INVAL, EINVAL }, /* that Sun forgot */
+#endif
+ { NFSERR_FBIG, EFBIG },
+ { NFSERR_NOSPC, ENOSPC },
+ { NFSERR_ROFS, EROFS },
+ { NFSERR_NAMETOOLONG, ENAMETOOLONG },
+ { NFSERR_NOTEMPTY, ENOTEMPTY },
+ { NFSERR_DQUOT, EDQUOT },
+ { NFSERR_STALE, ESTALE },
+#ifdef EWFLUSH
+ { NFSERR_WFLUSH, EWFLUSH },
+#endif
+ /* Throw in some NFSv3 values for even more fun (HP returns these) */
+ { 71, EREMOTE },
+};
+static int mnt_errtbl_sz = sizeof(mnt_errtbl)/sizeof(mnt_errtbl[0]);
+
+static inline int mnt_err_map(int stat)
+{
+ int i;
+
+ for (i = 0; i < mnt_errtbl_sz; i++) {
+ if (mnt_errtbl[i].stat == stat)
+ return -mnt_errtbl[i].errnum;
+ }
+ return -EACCES;
+}
+
struct mnt_fhstatus {
u32 status;
struct nfs_fh *fh;
@@ -98,7 +141,7 @@ out_call_err:
out_mnt_err:
dprintk("NFS: MNT server returned result %d\n", result.status);
- status = -EACCES;
+ status = mnt_err_map(result.status);
goto out;
}
^ permalink raw reply [flat|nested] 9+ messages in thread[parent not found: <47FF7FCC.2050403-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] NFS Client mounts hang when exported directory do not exist [not found] ` <47FF7FCC.2050403-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org> @ 2008-04-11 15:20 ` Eric Paris [not found] ` <1207927210.3379.1.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> 2008-04-11 16:22 ` Chuck Lever 1 sibling, 1 reply; 9+ messages in thread From: Eric Paris @ 2008-04-11 15:20 UTC (permalink / raw) To: Steve Dickson; +Cc: Fedora Kernel Mailing list, Linux NFS Mailing list On Fri, 2008-04-11 at 11:12 -0400, Steve Dickson wrote: > This patch fixes a regression that was introduced by the string based mounts. > > nfs_mount() statically returns -EACCES for every error returned > by the remote mounted. This is incorrect because -EACCES is > an non-fatal error to the mount.nfs command. This error causes > mount.nfs to retry the mount even in the case when the exported > directory does not exist. > > This patch maps the errors returned by the remote mountd into > valid errno values, exactly how it was done pre-string based > mounts. By returning the correct errno enables mount.nfs > to do the right thing. Does this mean the EACCES can/will again become fatal in mount.nfs like it used to be? https://bugzilla.redhat.com/show_bug.cgi?id=439807 -Eric ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <1207927210.3379.1.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>]
* Re: [PATCH] NFS Client mounts hang when exported directory do not exist [not found] ` <1207927210.3379.1.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> @ 2008-04-11 16:10 ` Steve Dickson [not found] ` <47FF8D6A.9040902-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Steve Dickson @ 2008-04-11 16:10 UTC (permalink / raw) To: Eric Paris; +Cc: Fedora Kernel Mailing list, Linux NFS Mailing list Eric Paris wrote: > On Fri, 2008-04-11 at 11:12 -0400, Steve Dickson wrote: >> This patch fixes a regression that was introduced by the string based mounts. >> >> nfs_mount() statically returns -EACCES for every error returned >> by the remote mounted. This is incorrect because -EACCES is >> an non-fatal error to the mount.nfs command. This error causes >> mount.nfs to retry the mount even in the case when the exported >> directory does not exist. >> >> This patch maps the errors returned by the remote mountd into >> valid errno values, exactly how it was done pre-string based >> mounts. By returning the correct errno enables mount.nfs >> to do the right thing. > > Does this mean the EACCES can/will again become fatal in mount.nfs like > it used to be? EACCES is still a non-fatal error as it was... The problem is the kernel was should have been returning ENOENT, which is a fatal error, instead of EACCES. steved. ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <47FF8D6A.9040902-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] NFS Client mounts hang when exported directory do not exist [not found] ` <47FF8D6A.9040902-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org> @ 2008-04-11 18:35 ` Eric Paris [not found] ` <1207938902.3379.7.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Eric Paris @ 2008-04-11 18:35 UTC (permalink / raw) To: Steve Dickson; +Cc: Linux NFS Mailing list, Fedora Kernel Mailing list On Fri, 2008-04-11 at 12:10 -0400, Steve Dickson wrote: > > Eric Paris wrote: > > On Fri, 2008-04-11 at 11:12 -0400, Steve Dickson wrote: > >> This patch fixes a regression that was introduced by the string based mounts. > >> > >> nfs_mount() statically returns -EACCES for every error returned > >> by the remote mounted. This is incorrect because -EACCES is > >> an non-fatal error to the mount.nfs command. This error causes > >> mount.nfs to retry the mount even in the case when the exported > >> directory does not exist. > >> > >> This patch maps the errors returned by the remote mountd into > >> valid errno values, exactly how it was done pre-string based > >> mounts. By returning the correct errno enables mount.nfs > >> to do the right thing. > > > > Does this mean the EACCES can/will again become fatal in mount.nfs like > > it used to be? > EACCES is still a non-fatal error as it was... "non-fatal error as it was"? Huh? Back in the days of binary mount data it was fatal. Try this on a new and old system. mount -o context=system_u:object_r:httpd_t:s0 server:/export /import old system it was fatal and we died instantly with EACCES telling the user it was a permissions problem. New system I have to waste 2 minutes and then get a message about it timing out. It wasn't a timeout, it was a permission failure. Users are going to be looking down the wrong path.. > The problem is the > kernel was should have been returning ENOENT, which is a fatal error, > instead of EACCES. That may well have been your problem, but it doesn't change the fact the EACCES has been a fatal error in mount.nfs until just recently. Why was it changed? When is EACCES not fatal? -Eric ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <1207938902.3379.7.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>]
* Re: [PATCH] NFS Client mounts hang when exported directory do not exist [not found] ` <1207938902.3379.7.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> @ 2008-04-12 0:14 ` Steve Dickson 0 siblings, 0 replies; 9+ messages in thread From: Steve Dickson @ 2008-04-12 0:14 UTC (permalink / raw) To: Eric Paris; +Cc: Linux NFS Mailing list, Fedora Kernel Mailing list Eric Paris wrote: > On Fri, 2008-04-11 at 12:10 -0400, Steve Dickson wrote: >>> Does this mean the EACCES can/will again become fatal in mount.nfs like >>> it used to be? >> EACCES is still a non-fatal error as it was... I guess I didn't look back far enough... > > "non-fatal error as it was"? Huh? Back in the days of binary mount > data it was fatal. Try this on a new and old system. Yes, I see... > That may well have been your problem, but it doesn't change the fact the > EACCES has been a fatal error in mount.nfs until just recently. Why was > it changed? When is EACCES not fatal? It appears the change came in with the text-based mount.nfs changes commit 4ce9ddfb03de06e90fb4cf0eb5767cb0e3a98905 Author: Chuck Lever <chuck.lever@oracle.com> Date: Wed Oct 10 15:06:39 2007 -0400 text-based mount.nfs: sort between permanent and temporary errors and I'm not sure why EACCES was deemed a non fatal error, but I'm beginning to agree with you... EACCES probably should be fatal... But thats something easily fixed in nfs-utils... steved. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] NFS Client mounts hang when exported directory do not exist [not found] ` <47FF7FCC.2050403-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org> 2008-04-11 15:20 ` Eric Paris @ 2008-04-11 16:22 ` Chuck Lever 2008-04-11 16:37 ` Steve Dickson 1 sibling, 1 reply; 9+ messages in thread From: Chuck Lever @ 2008-04-11 16:22 UTC (permalink / raw) To: Steve Dickson; +Cc: Fedora Kernel Mailing list, Linux NFS Mailing list [-- Attachment #1: Type: text/plain, Size: 2747 bytes --] Steve Dickson wrote: > This patch fixes a regression that was introduced by the string based mounts. > > nfs_mount() statically returns -EACCES for every error returned > by the remote mounted. This is incorrect because -EACCES is > an non-fatal error to the mount.nfs command. This error causes > mount.nfs to retry the mount even in the case when the exported > directory does not exist. I don't doubt this is the case, but I'd like to see a few real world examples (maybe even add them as documentary comments in mount.nfs or in the kernel). > This patch maps the errors returned by the remote mountd into > valid errno values, exactly how it was done pre-string based > mounts. By returning the correct errno enables mount.nfs > to do the right thing. > > Signed-off-by: Steve Dickson <steved@redhat.com> > --- > > diff -up linux/fs/nfs/mount_clnt.c.orig linux/fs/nfs/mount_clnt.c > --- linux/fs/nfs/mount_clnt.c.orig 2008-04-09 08:32:43.000000000 -0400 > +++ linux/fs/nfs/mount_clnt.c 2008-04-11 11:01:39.000000000 -0400 > @@ -21,6 +21,49 @@ > > static struct rpc_program mnt_program; > > +static struct { > + enum nfs_stat stat; > + int errnum; > +} mnt_errtbl[] = { > + { NFS_OK, 0 }, > + { NFSERR_PERM, EPERM }, > + { NFSERR_NOENT, ENOENT }, > + { NFSERR_IO, EIO }, > + { NFSERR_NXIO, ENXIO }, > + { NFSERR_ACCES, EACCES }, > + { NFSERR_EXIST, EEXIST }, > + { NFSERR_NODEV, ENODEV }, > + { NFSERR_NOTDIR, ENOTDIR }, > + { NFSERR_ISDIR, EISDIR }, > +#ifdef NFSERR_INVAL > + { NFSERR_INVAL, EINVAL }, /* that Sun forgot */ > +#endif > + { NFSERR_FBIG, EFBIG }, > + { NFSERR_NOSPC, ENOSPC }, > + { NFSERR_ROFS, EROFS }, > + { NFSERR_NAMETOOLONG, ENAMETOOLONG }, > + { NFSERR_NOTEMPTY, ENOTEMPTY }, > + { NFSERR_DQUOT, EDQUOT }, > + { NFSERR_STALE, ESTALE }, > +#ifdef EWFLUSH > + { NFSERR_WFLUSH, EWFLUSH }, > +#endif > + /* Throw in some NFSv3 values for even more fun (HP returns these) */ > + { 71, EREMOTE }, > +}; > +static int mnt_errtbl_sz = sizeof(mnt_errtbl)/sizeof(mnt_errtbl[0]); > + > +static inline int mnt_err_map(int stat) > +{ > + int i; > + > + for (i = 0; i < mnt_errtbl_sz; i++) { > + if (mnt_errtbl[i].stat == stat) > + return -mnt_errtbl[i].errnum; > + } > + return -EACCES; > +} > + This probably isn't necessary. It looks like nfs_stat_to_errno() already does everything you want. > struct mnt_fhstatus { > u32 status; > struct nfs_fh *fh; > @@ -98,7 +141,7 @@ out_call_err: > > out_mnt_err: > dprintk("NFS: MNT server returned result %d\n", result.status); > - status = -EACCES; > + status = mnt_err_map(result.status); The question here is whether nfs_mount's other caller (NFSROOT) can handle error codes other than EACCES. > goto out; > } [-- Attachment #2: Type: text/plain, Size: 169 bytes --] _______________________________________________ Fedora-kernel-list mailing list Fedora-kernel-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-kernel-list ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] NFS Client mounts hang when exported directory do not exist 2008-04-11 16:22 ` Chuck Lever @ 2008-04-11 16:37 ` Steve Dickson 0 siblings, 0 replies; 9+ messages in thread From: Steve Dickson @ 2008-04-11 16:37 UTC (permalink / raw) To: chuck.lever; +Cc: Fedora Kernel Mailing list, Linux NFS Mailing list Chuck Lever wrote: > Steve Dickson wrote: >> This patch fixes a regression that was introduced by the string based >> mounts. >> nfs_mount() statically returns -EACCES for every error returned >> by the remote mounted. This is incorrect because -EACCES is >> an non-fatal error to the mount.nfs command. This error causes >> mount.nfs to retry the mount even in the case when the exported >> directory does not exist. > > I don't doubt this is the case, but I'd like to see a few real world > examples (maybe even add them as documentary comments in mount.nfs or in > the kernel). Thats easy.. Do a Fedora install over NFS and mistype the mount point. Instead of returning immediately like it should, one has to wait 2mins for the error.. ENOENT during a mount has always been a fatal error as it should be and this patch is just restoring that fact. steved. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-04-12 0:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-11 16:05 [PATCH] NFS Client mounts hang when exported directory do not exist Steve Dickson
-- strict thread matches above, loose matches on Subject: below --
2008-04-12 0:03 Steve Dickson
2008-04-11 15:12 Steve Dickson
[not found] ` <47FF7FCC.2050403-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2008-04-11 15:20 ` Eric Paris
[not found] ` <1207927210.3379.1.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-04-11 16:10 ` Steve Dickson
[not found] ` <47FF8D6A.9040902-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2008-04-11 18:35 ` Eric Paris
[not found] ` <1207938902.3379.7.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-04-12 0:14 ` Steve Dickson
2008-04-11 16:22 ` Chuck Lever
2008-04-11 16:37 ` Steve Dickson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox