Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jan 2012 01:08:02 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r230249 - in head/sys: compat/freebsd32 fs/cd9660 fs/fdescfs fs/hpfs fs/msdosfs fs/nfsclient fs/ntfs fs/nwfs fs/portalfs fs/pseudofs fs/smbfs gnu/fs/reiserfs kern nfsclient sys ufs/ffs
Message-ID:  <201201170108.q0H182aY060349@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Tue Jan 17 01:08:01 2012
New Revision: 230249
URL: http://svn.freebsd.org/changeset/base/230249

Log:
  Make sure all intermediate variables holding mount flags (mnt_flag)
  and that all internal kernel calls passing mount flags are declared
  as uint64_t so that flags in the top 32-bits are not lost.
  
  MFC after: 2 weeks

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/fs/cd9660/cd9660_vfsops.c
  head/sys/fs/fdescfs/fdesc_vfsops.c
  head/sys/fs/hpfs/hpfs_vfsops.c
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/fs/ntfs/ntfs_vfsops.c
  head/sys/fs/nwfs/nwfs_vfsops.c
  head/sys/fs/portalfs/portal_vfsops.c
  head/sys/fs/pseudofs/pseudofs.c
  head/sys/fs/pseudofs/pseudofs.h
  head/sys/fs/smbfs/smbfs_vfsops.c
  head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_subr.c
  head/sys/nfsclient/nfs_vfsops.c
  head/sys/sys/mount.h
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -2485,9 +2485,17 @@ freebsd32_nmount(struct thread *td,
     } */ *uap)
 {
 	struct uio *auio;
+	uint64_t flags;
 	int error;
 
-	AUDIT_ARG_FFLAGS(uap->flags);
+	/*
+	 * Mount flags are now 64-bits. On 32-bit archtectures only
+	 * 32-bits are passed in, but from here on everything handles
+	 * 64-bit flags correctly.
+	 */
+	flags = uap->flags;
+
+	AUDIT_ARG_FFLAGS(flags);
 
 	/*
 	 * Filter out MNT_ROOTFS.  We do not want clients of nmount() in
@@ -2496,7 +2504,7 @@ freebsd32_nmount(struct thread *td,
 	 * MNT_ROOTFS should only be set by the kernel when mounting its
 	 * root file system.
 	 */
-	uap->flags &= ~MNT_ROOTFS;
+	flags &= ~MNT_ROOTFS;
 
 	/*
 	 * check that we have an even number of iovec's
@@ -2508,7 +2516,7 @@ freebsd32_nmount(struct thread *td,
 	error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
 	if (error)
 		return (error);
-	error = vfs_donmount(td, uap->flags, auio);
+	error = vfs_donmount(td, flags, auio);
 
 	free(auio, M_IOV);
 	return error;

Modified: head/sys/fs/cd9660/cd9660_vfsops.c
==============================================================================
--- head/sys/fs/cd9660/cd9660_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/cd9660/cd9660_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -95,7 +95,7 @@ static int iso_mountfs(struct vnode *dev
  */
 
 static int
-cd9660_cmount(struct mntarg *ma, void *data, int flags)
+cd9660_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	struct iso_args args;
 	struct export_args exp;

Modified: head/sys/fs/fdescfs/fdesc_vfsops.c
==============================================================================
--- head/sys/fs/fdescfs/fdesc_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/fdescfs/fdesc_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -65,7 +65,7 @@ static vfs_root_t	fdesc_root;
  * Compatibility shim for old mount(2) system call.
  */
 int
-fdesc_cmount(struct mntarg *ma, void *data, int flags)
+fdesc_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	return kernel_mount(ma, flags);
 }

Modified: head/sys/fs/hpfs/hpfs_vfsops.c
==============================================================================
--- head/sys/fs/hpfs/hpfs_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/hpfs/hpfs_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -73,7 +73,7 @@ static int
 hpfs_cmount ( 
 	struct mntarg *ma,
 	void *data,
-	int flags)
+	uint64_t flags)
 {
 	struct hpfs_args args;
 	struct export_args exp;

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -197,7 +197,7 @@ update_mp(struct mount *mp, struct threa
 }
 
 static int
-msdosfs_cmount(struct mntarg *ma, void *data, int flags)
+msdosfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	struct msdosfs_args args;
 	struct export_args exp;

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -1131,7 +1131,7 @@ out:
  */
 /* ARGSUSED */
 static int
-nfs_cmount(struct mntarg *ma, void *data, int flags)
+nfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	int error;
 	struct nfs_args args;

Modified: head/sys/fs/ntfs/ntfs_vfsops.c
==============================================================================
--- head/sys/fs/ntfs/ntfs_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/ntfs/ntfs_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -117,7 +117,7 @@ static int
 ntfs_cmount ( 
 	struct mntarg *ma,
 	void *data,
-	int flags)
+	uint64_t flags)
 {
 	struct ntfs_args args;
 	struct export_args exp;

Modified: head/sys/fs/nwfs/nwfs_vfsops.c
==============================================================================
--- head/sys/fs/nwfs/nwfs_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/nwfs/nwfs_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -123,7 +123,7 @@ nwfs_initnls(struct nwmount *nmp) {
 	return 0;
 }
 
-static int nwfs_cmount(struct mntarg *ma, void *data, int flags)
+static int nwfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	struct nwfs_args args; 	  /* will hold data from mount request */
 	int error;

Modified: head/sys/fs/portalfs/portal_vfsops.c
==============================================================================
--- head/sys/fs/portalfs/portal_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/portalfs/portal_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -69,7 +69,7 @@ static const char *portal_opts[] = {
 };
 
 static int
-portal_cmount(struct mntarg *ma, void *data, int flags)
+portal_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	struct portal_args args;
 	int error;

Modified: head/sys/fs/pseudofs/pseudofs.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/pseudofs/pseudofs.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -330,7 +330,7 @@ pfs_mount(struct pfs_info *pi, struct mo
  * Compatibility shim for old mount(2) system call
  */
 int
-pfs_cmount(struct mntarg *ma, void *data, int flags)
+pfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	int error;
 

Modified: head/sys/fs/pseudofs/pseudofs.h
==============================================================================
--- head/sys/fs/pseudofs/pseudofs.h	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/pseudofs/pseudofs.h	Tue Jan 17 01:08:01 2012	(r230249)
@@ -242,7 +242,7 @@ struct pfs_node {
  * VFS interface
  */
 int		 pfs_mount	(struct pfs_info *pi, struct mount *mp);
-int		 pfs_cmount	(struct mntarg *ma, void *data, int flags);
+int		 pfs_cmount	(struct mntarg *ma, void *data, uint64_t flags);
 int		 pfs_unmount	(struct mount *mp, int mntflags);
 int		 pfs_root	(struct mount *mp, int flags,
 				 struct vnode **vpp);

Modified: head/sys/fs/smbfs/smbfs_vfsops.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/fs/smbfs/smbfs_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -98,7 +98,7 @@ MODULE_DEPEND(smbfs, libmchain, 1, 1, 1)
 int smbfs_pbuf_freecnt = -1;	/* start out unlimited */
 
 static int
-smbfs_cmount(struct mntarg *ma, void * data, int flags)
+smbfs_cmount(struct mntarg *ma, void * data, uint64_t flags)
 {
 	struct smbfs_args args;
 	int error;

Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
==============================================================================
--- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -49,7 +49,7 @@ MALLOC_DEFINE(M_REISERFSNODE, "reiserfs_
  * -------------------------------------------------------------------*/
 
 static int
-reiserfs_cmount(struct mntarg *ma, void *data, int flags)
+reiserfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	struct reiserfs_args args;
 	struct export_args exp;

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/kern/vfs_mount.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -72,8 +72,8 @@ __FBSDID("$FreeBSD$");
 
 #define	VFS_MOUNTARG_SIZE_MAX	(1024 * 64)
 
-static int	vfs_domount(struct thread *td, const char *fstype,
-		    char *fspath, int fsflags, struct vfsoptlist **optlist);
+static int	vfs_domount(struct thread *td, const char *fstype, char *fspath,
+		    uint64_t fsflags, struct vfsoptlist **optlist);
 static void	free_mntarg(struct mntarg *ma);
 
 static int	usermount = 0;
@@ -378,10 +378,18 @@ sys_nmount(td, uap)
 	struct uio *auio;
 	int error;
 	u_int iovcnt;
+	uint64_t flags;
 
-	AUDIT_ARG_FFLAGS(uap->flags);
+	/*
+	 * Mount flags are now 64-bits. On 32-bit archtectures only
+	 * 32-bits are passed in, but from here on everything handles
+	 * 64-bit flags correctly.
+	 */
+	flags = uap->flags;
+
+	AUDIT_ARG_FFLAGS(flags);
 	CTR4(KTR_VFS, "%s: iovp %p with iovcnt %d and flags %d", __func__,
-	    uap->iovp, uap->iovcnt, uap->flags);
+	    uap->iovp, uap->iovcnt, flags);
 
 	/*
 	 * Filter out MNT_ROOTFS.  We do not want clients of nmount() in
@@ -390,7 +398,7 @@ sys_nmount(td, uap)
 	 * MNT_ROOTFS should only be set by the kernel when mounting its
 	 * root file system.
 	 */
-	uap->flags &= ~MNT_ROOTFS;
+	flags &= ~MNT_ROOTFS;
 
 	iovcnt = uap->iovcnt;
 	/*
@@ -409,7 +417,7 @@ sys_nmount(td, uap)
 		    __func__, error);
 		return (error);
 	}
-	error = vfs_donmount(td, uap->flags, auio);
+	error = vfs_donmount(td, flags, auio);
 
 	free(auio, M_IOV);
 	return (error);
@@ -520,7 +528,7 @@ vfs_mount_destroy(struct mount *mp)
 }
 
 int
-vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
+vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions)
 {
 	struct vfsoptlist *optlist;
 	struct vfsopt *opt, *tmp_opt;
@@ -696,9 +704,17 @@ sys_mount(td, uap)
 	char *fstype;
 	struct vfsconf *vfsp = NULL;
 	struct mntarg *ma = NULL;
+	uint64_t flags;
 	int error;
 
-	AUDIT_ARG_FFLAGS(uap->flags);
+	/*
+	 * Mount flags are now 64-bits. On 32-bit archtectures only
+	 * 32-bits are passed in, but from here on everything handles
+	 * 64-bit flags correctly.
+	 */
+	flags = uap->flags;
+
+	AUDIT_ARG_FFLAGS(flags);
 
 	/*
 	 * Filter out MNT_ROOTFS.  We do not want clients of mount() in
@@ -707,7 +723,7 @@ sys_mount(td, uap)
 	 * MNT_ROOTFS should only be set by the kernel when mounting its
 	 * root file system.
 	 */
-	uap->flags &= ~MNT_ROOTFS;
+	flags &= ~MNT_ROOTFS;
 
 	fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK);
 	error = copyinstr(uap->type, fstype, MFSNAMELEN, NULL);
@@ -731,11 +747,11 @@ sys_mount(td, uap)
 
 	ma = mount_argsu(ma, "fstype", uap->type, MNAMELEN);
 	ma = mount_argsu(ma, "fspath", uap->path, MNAMELEN);
-	ma = mount_argb(ma, uap->flags & MNT_RDONLY, "noro");
-	ma = mount_argb(ma, !(uap->flags & MNT_NOSUID), "nosuid");
-	ma = mount_argb(ma, !(uap->flags & MNT_NOEXEC), "noexec");
+	ma = mount_argb(ma, flags & MNT_RDONLY, "noro");
+	ma = mount_argb(ma, !(flags & MNT_NOSUID), "nosuid");
+	ma = mount_argb(ma, !(flags & MNT_NOEXEC), "noexec");
 
-	error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, uap->flags);
+	error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, flags);
 	mtx_unlock(&Giant);
 	return (error);
 }
@@ -749,7 +765,7 @@ vfs_domount_first(
 	struct vfsconf *vfsp,		/* File system type. */
 	char *fspath,			/* Mount path. */
 	struct vnode *vp,		/* Vnode to be covered. */
-	int fsflags,			/* Flags common to all filesystems. */
+	uint64_t fsflags,		/* Flags common to all filesystems. */
 	struct vfsoptlist **optlist	/* Options local to the filesystem. */
 	)
 {
@@ -871,14 +887,15 @@ static int
 vfs_domount_update(
 	struct thread *td,		/* Calling thread. */
 	struct vnode *vp,		/* Mount point vnode. */
-	int fsflags,			/* Flags common to all filesystems. */
+	uint64_t fsflags,		/* Flags common to all filesystems. */
 	struct vfsoptlist **optlist	/* Options local to the filesystem. */
 	)
 {
 	struct oexport_args oexport;
 	struct export_args export;
 	struct mount *mp;
-	int error, export_error, flag;
+	int error, export_error;
+	uint64_t flag;
 
 	mtx_assert(&Giant, MA_OWNED);
 	ASSERT_VOP_ELOCKED(vp, __func__);
@@ -1015,7 +1032,7 @@ vfs_domount(
 	struct thread *td,		/* Calling thread. */
 	const char *fstype,		/* Filesystem type. */
 	char *fspath,			/* Mount path. */
-	int fsflags,			/* Flags common to all filesystems. */
+	uint64_t fsflags,		/* Flags common to all filesystems. */
 	struct vfsoptlist **optlist	/* Options local to the filesystem. */
 	)
 {
@@ -1216,7 +1233,7 @@ dounmount(mp, flags, td)
 {
 	struct vnode *coveredvp, *fsrootvp;
 	int error;
-	int async_flag;
+	uint64_t async_flag;
 	int mnt_gen_r;
 
 	mtx_assert(&Giant, MA_OWNED);
@@ -1925,7 +1942,7 @@ free_mntarg(struct mntarg *ma)
  * Mount a filesystem
  */
 int
-kernel_mount(struct mntarg *ma, int flags)
+kernel_mount(struct mntarg *ma, uint64_t flags)
 {
 	struct uio auio;
 	int error;

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/kern/vfs_subr.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -2836,6 +2836,7 @@ DB_SHOW_COMMAND(mount, db_show_mount)
 	struct statfs *sp;
 	struct vnode *vp;
 	char buf[512];
+	uint64_t mflags;
 	u_int flags;
 
 	if (!have_addr) {
@@ -2857,13 +2858,13 @@ DB_SHOW_COMMAND(mount, db_show_mount)
 	    mp->mnt_stat.f_mntonname, mp->mnt_stat.f_fstypename);
 
 	buf[0] = '\0';
-	flags = mp->mnt_flag;
+	mflags = mp->mnt_flag;
 #define	MNT_FLAG(flag)	do {						\
-	if (flags & (flag)) {						\
+	if (mflags & (flag)) {						\
 		if (buf[0] != '\0')					\
 			strlcat(buf, ", ", sizeof(buf));		\
 		strlcat(buf, (#flag) + 4, sizeof(buf));			\
-		flags &= ~(flag);					\
+		mflags &= ~(flag);					\
 	}								\
 } while (0)
 	MNT_FLAG(MNT_RDONLY);
@@ -2901,11 +2902,11 @@ DB_SHOW_COMMAND(mount, db_show_mount)
 	MNT_FLAG(MNT_SNAPSHOT);
 	MNT_FLAG(MNT_BYFSID);
 #undef MNT_FLAG
-	if (flags != 0) {
+	if (mflags != 0) {
 		if (buf[0] != '\0')
 			strlcat(buf, ", ", sizeof(buf));
 		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
-		    "0x%08x", flags);
+		    "0x%016jx", mflags);
 	}
 	db_printf("    mnt_flag = %s\n", buf);
 

Modified: head/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- head/sys/nfsclient/nfs_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/nfsclient/nfs_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -1187,7 +1187,7 @@ out:
  */
 /* ARGSUSED */
 static int
-nfs_cmount(struct mntarg *ma, void *data, int flags)
+nfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	int error;
 	struct nfs_args args;

Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/sys/mount.h	Tue Jan 17 01:08:01 2012	(r230249)
@@ -557,7 +557,7 @@ struct nameidata;
 struct sysctl_req;
 struct mntarg;
 
-typedef int vfs_cmount_t(struct mntarg *ma, void *data, int flags);
+typedef int vfs_cmount_t(struct mntarg *ma, void *data, uint64_t flags);
 typedef int vfs_unmount_t(struct mount *mp, int mntflags);
 typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp);
 typedef	int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg);
@@ -700,7 +700,7 @@ extern	char *mountrootfsname;
 
 int	dounmount(struct mount *, int, struct thread *);
 
-int	kernel_mount(struct mntarg *ma, int flags);
+int	kernel_mount(struct mntarg *ma, uint64_t flags);
 int	kernel_vmount(int flags, ...);
 struct mntarg *mount_arg(struct mntarg *ma, const char *name, const void *val, int len);
 struct mntarg *mount_argb(struct mntarg *ma, int flag, const char *name);
@@ -737,7 +737,8 @@ int	vfs_export			 /* process mount expor
 	    (struct mount *, struct export_args *);
 void	vfs_allocate_syncvnode(struct mount *);
 void	vfs_deallocate_syncvnode(struct mount *);
-int	vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions);
+int	vfs_donmount(struct thread *td, uint64_t fsflags,
+	    struct uio *fsoptions);
 void	vfs_getnewfsid(struct mount *);
 struct cdev *vfs_getrootfsid(struct mount *);
 struct	mount *vfs_getvfs(fsid_t *);      /* return vfs given fsid */

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Tue Jan 17 00:34:16 2012	(r230248)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Tue Jan 17 01:08:01 2012	(r230249)
@@ -144,7 +144,7 @@ ffs_mount(struct mount *mp)
 	struct fs *fs;
 	pid_t fsckpid = 0;
 	int error, flags;
-	u_int mntorflags;
+	uint64_t mntorflags;
 	accmode_t accmode;
 	struct nameidata ndp;
 	char *fspec;
@@ -571,7 +571,7 @@ ffs_mount(struct mount *mp)
  */
 
 static int
-ffs_cmount(struct mntarg *ma, void *data, int flags)
+ffs_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
 	struct ufs_args args;
 	struct export_args exp;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201170108.q0H182aY060349>