Skip to contentSkip to conversation

Patch to mountd to mount files > 2GB

PATCH Andrew Gray 1 participant 1 message Jan 14, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Greetings all,

If this has been problem/solution has been posted before, please disregard :)

I'm using NFS to serve out FLAR archives to Sun machines. These files are > 2GB, and the auto-installer for the Sun boxes mount the files, not the directories. mountd was refusing to authenticate these otherwise legit requests because the stat() call was bombing due the filesize being too large. I hacked up the quick diff below that fixed the problem. The files transfer correctly and completely, but I admit I haven't performed further testing.

diff -u nfs-utils-1.0.6-orig/utils/mountd/mountd.c nfs-utils-1.0.6/utils/mountd/mountd.c

utils/mountd/mountd.c Tue Jan 13 20:11:49 2004 renamed from utils/mountd/mountd.c Fri Sep 12 15:14:16 2003 +5 -5
@@ -176,7 +176,7 @@
 {
        struct sockaddr_in *sin
                = (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
-       struct stat     stb;
+       struct stat64   stb;
        nfs_export      *exp;
        char            rpath[MAXPATHLEN+1];
        char            *p = *path;
@@ -198,7 +198,7 @@
        /* Now authenticate the intruder... */
        if (!(exp = auth_authenticate("pathconf", sin, p))) {
                return 1;
-       } else if (stat(p, &stb) < 0) {
+       } else if (stat64(p, &stb) < 0) {
                xlog(L_WARNING, "can't stat exported dir %s: %s",
                                p, strerror(errno));
                export_reset (exp);
@@ -248,7 +248,7 @@
 {
        struct sockaddr_in *sin =
                (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
-       struct stat     stb, estb;
+       struct stat64   stb, estb;
        nfs_export      *exp;
        char            rpath[MAXPATHLEN+1];
        char            *p = *path;
@@ -268,7 +268,7 @@
        /* Now authenticate the intruder... */
        if (!(exp = auth_authenticate("mount", sin, p))) {
                *error = NFSERR_ACCES;
-       } else if (stat(p, &stb) < 0) {
+       } else if (stat64(p, &stb) < 0) {
                xlog(L_WARNING, "can't stat exported dir %s: %s",
                                p, strerror(errno));
                if (errno == ENOENT)
@@ -278,7 +278,7 @@
        } else if (!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode)) {
                xlog(L_WARNING, "%s is not a directory or regular file", p);
                *error = NFSERR_NOTDIR;
-       } else if (stat(exp->m_export.e_path, &estb) < 0) {
+       } else if (stat64(exp->m_export.e_path, &estb) < 0) {
                xlog(L_WARNING, "can't stat export point %s: %s",
                     p, strerror(errno));
                *error = NFSERR_NOENT;