DragonFly BSD
DragonFly bugs List (threaded) for 2012-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[DragonFlyBSD - Bug #2277] tmpfs can't be nfs exported


From: Venkatesh Srinivas via Redmine <bugtracker-admin@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 30 Jan 2012 19:33:59 -0800

Issue #2277 has been updated by Venkatesh Srinivas.

Assignee set to Venkatesh Srinivas

Initial patch, works locally; not extensively tested::


diff --git a/sys/vfs/tmpfs/tmpfs.h b/sys/vfs/tmpfs/tmpfs.h
index 4404cc6..609b1c1 100644
--- a/sys/vfs/tmpfs/tmpfs.h
+++ b/sys/vfs/tmpfs/tmpfs.h
@@ -399,6 +399,8 @@ struct tmpfs_mount {
        struct objcache         *tm_node_pool;
 
        int                     tm_flags;
+
+       struct netexport        tm_export;
 };
 
 #define TMPFS_LOCK(tm) lockmgr(&(tm)->allnode_lock, LK_EXCLUSIVE|LK_RETRY)
diff --git a/sys/vfs/tmpfs/tmpfs_vfsops.c b/sys/vfs/tmpfs/tmpfs_vfsops.c
index 940643a..9ad3084 100644
--- a/sys/vfs/tmpfs/tmpfs_vfsops.c
+++ b/sys/vfs/tmpfs/tmpfs_vfsops.c
@@ -145,12 +145,9 @@ tmpfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
        gid_t   root_gid = cred->cr_gid;
        mode_t  root_mode = (VREAD | VWRITE);
 
-       if (mp->mnt_flag & MNT_UPDATE) {
-               /* XXX: There is no support yet to update file system
-                * settings.  Should be added. */
-
-               return EOPNOTSUPP;
-       }
+       /* XXX */
+       if (mp->mnt_flag & MNT_UPDATE) 
+               return (EOPNOTSUPP);
 
        /*
         * mount info
@@ -174,6 +171,7 @@ tmpfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
                root_mode = args.ta_root_mode;
        }
 
+
        /*
         * If mount by non-root, then verify that user has necessary
         * permissions on the device.
@@ -518,6 +516,27 @@ tmpfs_vptofh(struct vnode *vp, struct fid *fhp)
 
 /* --------------------------------------------------------------------- */
 
+static int
+tmpfs_checkexp(struct mount *mp, struct sockaddr *nam, int *exflagsp,
+              struct ucred **credanonp)
+{
+       struct tmpfs_mount *tmp;
+       struct netcred *nc;
+
+       tmp = (struct tmpfs_mount *) mp->mnt_data;
+       nc = vfs_export_lookup(mp, &tmp->tm_export, nam);
+       if (nc == NULL)
+               return (EACCES);
+
+       *exflagsp = nc->netc_exflags;
+       *credanonp = &nc->netc_anon;
+
+       return (0);
+}
+
+/* --------------------------------------------------------------------- */
+
+
 /*
  * tmpfs vfs operations.
  */
@@ -529,7 +548,8 @@ static struct vfsops tmpfs_vfsops = {
        .vfs_statfs =                   tmpfs_statfs,
        .vfs_fhtovp =                   tmpfs_fhtovp,
        .vfs_vptofh =                   tmpfs_vptofh, 
-       .vfs_sync =                     vfs_stdsync
+       .vfs_sync =                     vfs_stdsync,
+       .vfs_checkexp =                 tmpfs_checkexp,
 };
 
 VFS_SET(tmpfs_vfsops, tmpfs, 0);
diff --git a/sys/vfs/tmpfs/tmpfs_vnops.c b/sys/vfs/tmpfs/tmpfs_vnops.c
index 3a5d7a0..9726272 100644
--- a/sys/vfs/tmpfs/tmpfs_vnops.c
+++ b/sys/vfs/tmpfs/tmpfs_vnops.c
@@ -48,6 +48,7 @@
 #include <sys/unistd.h>
 #include <sys/vfsops.h>
 #include <sys/vnode.h>
+#include <sys/mountctl.h>
 
 #include <vm/vm.h>
 #include <vm/vm_object.h>
@@ -1680,6 +1681,33 @@ filt_tmpfsvnode(struct knote *kn, long hint)
 
 /* --------------------------------------------------------------------- */
 
+static int
+tmpfs_mountctl(struct vop_mountctl_args *ap)
+{
+       struct tmpfs_mount *tmp;
+       struct mount *mp;
+       int rc;
+
+       switch (ap->a_op) {
+       case (MOUNTCTL_SET_EXPORT):
+               mp = ap->a_head.a_ops->head.vv_mount;
+               tmp = (struct tmpfs_mount *) mp->mnt_data;
+
+               if (ap->a_ctllen != sizeof(struct export_args))
+                       rc = (EINVAL);
+               else
+                       rc = vfs_export(mp, &tmp->tm_export, 
+                                       (struct export_args *) ap->a_ctl);
+               break;
+       default:
+               rc = vop_stdmountctl(ap);
+               break;
+       }
+       return (rc);
+}
+
+/* --------------------------------------------------------------------- */
+
 /*
  * vnode operations vector used for files stored in a tmpfs file system.
  */
@@ -1699,6 +1727,7 @@ struct vop_ops tmpfs_vnode_vops = {
        .vop_read =                     tmpfs_read,
        .vop_write =                    tmpfs_write,
        .vop_fsync =                    tmpfs_fsync,
+       .vop_mountctl =                 tmpfs_mountctl,
        .vop_nremove =                  tmpfs_nremove,
        .vop_nlink =                    tmpfs_nlink,
        .vop_nrename =                  tmpfs_nrename,

----------------------------------------
Bug #2277: tmpfs can't be nfs exported
http://bugs.dragonflybsd.org/issues/2277

Author: Thomas Nikolajsen
Status: New
Priority: Normal
Assignee: Venkatesh Srinivas
Category: 
Target version: 


Using fresh master (January 17th 2012)
nfs export of tmpfs mount point fails.

Errors from mountd(8) in /var/log/messages are:
can't export /tmp
bad exports list line /tmp -maproot

/etc/exports line: /tmp -maproot=root 127.0.0.1

(nfs export of mfs mount point works)

 -thomas


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



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