Date: Sun, 29 Jan 2012 08:03:45 +0000 (UTC) From: Kirk McKusick <mckusick@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r230725 - in stable/9/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: <201201290803.q0T83jnM091202@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mckusick Date: Sun Jan 29 08:03:45 2012 New Revision: 230725 URL: http://svn.freebsd.org/changeset/base/230725 Log: MFC r230249: 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 r230250: There are several bugs/hangs when trying to take a snapshot on a UFS/FFS filesystem running with journaled soft updates. Until these problems have been tracked down, return ENOTSUPP when an attempt is made to take a snapshot on a filesystem running with journaled soft updates. Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c stable/9/sys/fs/cd9660/cd9660_vfsops.c stable/9/sys/fs/fdescfs/fdesc_vfsops.c stable/9/sys/fs/hpfs/hpfs_vfsops.c stable/9/sys/fs/msdosfs/msdosfs_vfsops.c stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/fs/ntfs/ntfs_vfsops.c stable/9/sys/fs/nwfs/nwfs_vfsops.c stable/9/sys/fs/portalfs/portal_vfsops.c stable/9/sys/fs/pseudofs/pseudofs.c stable/9/sys/fs/pseudofs/pseudofs.h stable/9/sys/fs/smbfs/smbfs_vfsops.c stable/9/sys/gnu/fs/reiserfs/reiserfs_vfsops.c stable/9/sys/kern/vfs_mount.c stable/9/sys/kern/vfs_subr.c stable/9/sys/nfsclient/nfs_vfsops.c stable/9/sys/sys/mount.h stable/9/sys/ufs/ffs/ffs_snapshot.c stable/9/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_misc.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/compat/freebsd32/freebsd32_misc.c Sun Jan 29 08:03:45 2012 (r230725) @@ -2465,9 +2465,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 @@ -2476,7 +2484,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 @@ -2488,7 +2496,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: stable/9/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- stable/9/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/fdescfs/fdesc_vfsops.c ============================================================================== --- stable/9/sys/fs/fdescfs/fdesc_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/fdescfs/fdesc_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/hpfs/hpfs_vfsops.c ============================================================================== --- stable/9/sys/fs/hpfs/hpfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/hpfs/hpfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/ntfs/ntfs_vfsops.c ============================================================================== --- stable/9/sys/fs/ntfs/ntfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/ntfs/ntfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/nwfs/nwfs_vfsops.c ============================================================================== --- stable/9/sys/fs/nwfs/nwfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/nwfs/nwfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/portalfs/portal_vfsops.c ============================================================================== --- stable/9/sys/fs/portalfs/portal_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/portalfs/portal_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/pseudofs/pseudofs.c ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/pseudofs/pseudofs.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/pseudofs/pseudofs.h ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs.h Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/pseudofs/pseudofs.h Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/fs/smbfs/smbfs_vfsops.c ============================================================================== --- stable/9/sys/fs/smbfs/smbfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/smbfs/smbfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/gnu/fs/reiserfs/reiserfs_vfsops.c ============================================================================== --- stable/9/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/kern/vfs_mount.c ============================================================================== --- stable/9/sys/kern/vfs_mount.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/kern/vfs_mount.c Sun Jan 29 08:03:45 2012 (r230725) @@ -70,8 +70,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; @@ -376,10 +376,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 @@ -388,7 +396,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; /* @@ -407,7 +415,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); @@ -518,7 +526,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; @@ -694,9 +702,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 @@ -705,7 +721,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); @@ -729,11 +745,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); } @@ -747,7 +763,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. */ ) { @@ -856,14 +872,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__); @@ -1000,7 +1017,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. */ ) { @@ -1182,7 +1199,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); @@ -1891,7 +1908,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: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/kern/vfs_subr.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/9/sys/nfsclient/nfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/nfsclient/nfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/sys/mount.h ============================================================================== --- stable/9/sys/sys/mount.h Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/sys/mount.h Sun Jan 29 08:03:45 2012 (r230725) @@ -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: stable/9/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_snapshot.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/ufs/ffs/ffs_snapshot.c Sun Jan 29 08:03:45 2012 (r230725) @@ -225,10 +225,18 @@ ffs_snapshot(mp, snapfile) ump = VFSTOUFS(mp); fs = ump->um_fs; sn = NULL; + /* + * At the moment, journaled soft updates cannot support + * taking snapshots. + */ + if (MOUNTEDSUJ(mp)) { + vfs_mount_error(mp, "%s: Snapshots are not yet supported when " + "running with journaled soft updates", fs->fs_fsmnt); + return (EOPNOTSUPP); + } MNT_ILOCK(mp); flag = mp->mnt_flag; MNT_IUNLOCK(mp); - /* * Need to serialize access to snapshot code per filesystem. */ Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/ufs/ffs/ffs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -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; @@ -564,7 +564,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?201201290803.q0T83jnM091202>