Date: Sun, 31 Jul 2011 04:38:47 GMT From: Brandon Gooch <jamesbrandongooch@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/159322: [PATCH] sysutils/fusefs-kmod doesn't build due to recent changes in vfs_flagopt(9) Message-ID: <201107310438.p6V4clu7082758@red.freebsd.org> Resent-Message-ID: <201107310440.p6V4e6Ui052592@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 159322 >Category: ports >Synopsis: [PATCH] sysutils/fusefs-kmod doesn't build due to recent changes in vfs_flagopt(9) >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Sun Jul 31 04:40:06 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Brandon Gooch >Release: 9-CURRENT amd64 >Organization: >Environment: FreeBSD m6500.local 9.0-BETA1 FreeBSD 9.0-BETA1 #0 r224414: Tue Jul 26 02:22:28 CDT 2011 root@m6500.local:/usr/obj/usr/src/sys/DELL_M6500 amd64 >Description: A recent change to vfs_flagopt(9) has resulted in an un-buildable sysutils/fusefs-kmod. The patch provided brings the fusefs-kmod port's use of vfs_flagopt(9) up-to-date. >From the commit log: This update changes the mnt_flag field in the mount structure from 32 bits to 64 bits and eliminates the unused mnt_xflag field. The existing mnt_flag field is completely out of bits, so this update gives us room to expand. Note that the f_flags field in the statfs structure is already 64 bits, so the expanded mnt_flag field can be exported without having to make any changes in the statfs structure. Approved by: re (bz) http://svnweb.freebsd.org/base?view=revision&revision=224290 >How-To-Repeat: Try to build sysutils/fusefs-kmod on 9-CURRENT after r224290. >Fix: Drop the supplied patch into sysutils/fusefs-kmod/files/ (you can remove the .txt extension) -- overwriting the file that exists. Run `make clean` and then rebuild the port. Patch attached with submission follows: --- fuse_module/fuse_vfsops.c.orig 2008-02-04 23:25:57.000000000 -0600 +++ fuse_module/fuse_vfsops.c 2011-07-30 23:09:43.000000000 -0500 @@ -18,6 +18,7 @@ #include <sys/namei.h> #include <sys/mount.h> #include <sys/sysctl.h> +#include <sys/fcntl.h> #include "fuse.h" #include "fuse_session.h" @@ -60,14 +61,14 @@ }; SYSCTL_INT(_vfs_fuse, OID_AUTO, init_backgrounded, CTLFLAG_RD, - 0, 1, "indicate async handshake"); + 0, 1, "indicate async handshake"); static int fuse_enforce_dev_perms = 0; SYSCTL_LONG(_vfs_fuse, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, - &fuse_enforce_dev_perms, 0, - "enforce fuse device permissions for secondary mounts"); + &fuse_enforce_dev_perms, 0, + "enforce fuse device permissions for secondary mounts"); static unsigned sync_unmount = 1; SYSCTL_UINT(_vfs_fuse, OID_AUTO, sync_unmount, CTLFLAG_RW, - &sync_unmount, 0, "specify when to use synchronous unmount"); + &sync_unmount, 0, "specify when to use synchronous unmount"); MALLOC_DEFINE(M_FUSEVFS, "fuse_filesystem", "buffer for fuse vfs layer"); @@ -155,8 +156,8 @@ if (VTOI(vp) == pmp->nodeid) { KASSERT(! pmp->valid, - ("more than one vnode seems to match #%llu", - (unsigned long long)pmp->nodeid)); + ("more than one vnode seems to match #%llu", + (unsigned long long)pmp->nodeid)); VTOFUD(vp)->parent_nid = pmp->parent_nid; pmp->valid = 1; } @@ -213,8 +214,14 @@ * Mount system call */ static int +#if VFSOPS_TAKES_THREAD fuse_mount(struct mount *mp, struct thread *td) { +#else +fuse_mount(struct mount *mp) +{ + struct thread *td = curthread; +#endif int err = 0; size_t len; char *fspec, *subtype = NULL; @@ -224,14 +231,13 @@ struct cdev *fdev; struct sx *slock; struct fuse_data *data; - int mntopts = 0, __mntopts = 0, max_read_set = 0, secondary = 0; + uint64_t mntopts = 0, __mntopts = 0, max_read_set = 0, secondary = 0; unsigned max_read = ~0; struct vnode *rvp; struct fuse_vnode_data *fvdat; GIANT_REQUIRED; - KASSERT(fuse_useco >= 0, - ("negative fuse usecount despite Giant")); + KASSERT(fuse_useco >= 0, ("negative fuse usecount despite Giant")); if (mp->mnt_flag & MNT_UPDATE) return (EOPNOTSUPP); @@ -257,7 +263,7 @@ /* * Not an update, or updating the name: look up the name * and verify that it refers to a sensible disk device. - */ + */ NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td); if ((err = namei(ndp)) != 0) @@ -318,10 +324,10 @@ FUSE_UNLOCK; dev_rel(fdev); return (ENXIO); - } + } FUSE_UNLOCK; - /* + /* * With the help of underscored options the mount program * can inform us from the flags it sets by default */ @@ -361,7 +367,7 @@ DEBUG2G("mntopts 0x%x\n", mntopts); - /* Sanity + permission checks */ + /* Sanity + permission checks */ if (! data->daemoncred) panic("fuse daemon found, but identity unknown"); @@ -371,7 +377,7 @@ if (data->dataflag & FSESS_PRIVATE) /* * device is owned and owner doesn't - * wanna share it with us + * wanna share it with us */ err = EPERM; if (/* actual option set differs from default */ @@ -422,9 +428,9 @@ if (! err) { err = vn_lock(rvp, LK_EXCLUSIVE | LK_RETRY #if VN_LOCK_TAKES_THREAD - , td + , td #endif - ); + ); #if NEW_VNODES_ADJUSTED_MANUALLY if (err) printf("fuse4bsd: leaking vnode %p\n", rvp); @@ -450,13 +456,13 @@ fdata_kick_set(data); sx_xunlock(slock); free(fvdat, M_FUSEVN); - goto out; + goto out; } else VOP_UNLOCK(rvp, 0 #if VOP_UNLOCK_TAKES_THREAD - , td + , td #endif - ); + ); data->mp = mp; data->mpri = FM_PRIMARY; data->dataflag |= mntopts; @@ -468,7 +474,7 @@ sx_xunlock(slock); - vfs_getnewfsid(mp); + vfs_getnewfsid(mp); mp->mnt_flag |= MNT_LOCAL; #ifdef MNTK_MPSAFE mp->mnt_kern_flag |= MNTK_MPSAFE; @@ -499,7 +505,7 @@ len++; } else { sprintf(mp->mnt_stat.f_mntfromname + len, "%d", - data->mntco - 1); + data->mntco - 1); len += log; } } @@ -529,8 +535,14 @@ * Unmount system call */ static int +#if VFSOPS_TAKES_THREAD fuse_unmount(struct mount *mp, int mntflags, struct thread *td) { +#else +fuse_unmount(struct mount *mp, int mntflags) +{ + struct thread *td = curthread; +#endif int flags = 0, err = 0; struct fuse_data *data; struct fuse_secondary_data *fsdat = NULL; @@ -558,7 +570,7 @@ struct vnode *vp, *nvp; #endif - if (! (mntflags & MNT_FORCE || + if (!(mntflags & MNT_FORCE || data->dataflag & FSESS_NEGLECT_SHARES || LIST_EMPTY(&data->slaves_head))) { err = EBUSY; @@ -590,14 +602,14 @@ #if FUSE_HAS_DESTROY if (data->dataflag & FSESS_SYNC_UNMOUNT && ((sync_unmount == 1 && - data->dataflag & FSESS_CAN_SYNC_UNMOUNT) || - sync_unmount == 2) && + data->dataflag & FSESS_CAN_SYNC_UNMOUNT) || + sync_unmount == 2) && !(mntflags & MNT_FORCE)) { struct fuse_dispatcher fdi; fdisp_init(&fdi, 0); fdisp_make(&fdi, mp, FUSE_DESTROY, FUSE_ROOT_ID, td, - NULL); + NULL); fdisp_wait_answ(&fdi); /* ignore return value */ } @@ -616,7 +628,7 @@ FUSE_LOCK; fdev = data->fdev; DEBUG2G("mntco %d, opened 0x%x\n", - data->mntco, data->dataflag & FSESS_OPENED); + data->mntco, data->dataflag & FSESS_OPENED); if (data->mntco == 0 && ! (data->dataflag & FSESS_OPENED)) { data->fdev->si_drv1 = NULL; fdata_destroy(data); @@ -629,12 +641,18 @@ mp->mnt_flag &= ~MNT_LOCAL; return (0); -} +} /* stolen from portalfs */ static int +#if VFSOPS_TAKES_THREAD fuse_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { +#else +fuse_root(struct mount *mp, int flags, struct vnode **vpp) +{ + struct thread *td = curthread; +#endif /* * Return locked reference to root. */ @@ -650,7 +668,11 @@ data = fsdat->master; sx_slock(&data->mhierlock); if (data->mpri == FM_PRIMARY) - err = fuse_root(data->mp, flags, vpp, td); + err = fuse_root(data->mp, flags, vpp +#if VFSOPS_TAKES_THREAD + , td +#endif + ); else err = ENXIO; sx_sunlock(&data->mhierlock); @@ -661,13 +683,17 @@ vref(vp); vn_lock(vp, flags | LK_RETRY #if VN_LOCK_TAKES_THREAD - , td + , td #endif - ); + ); if (vp->v_type == VNON) { struct vattr va; - (void)VOP_GETATTR(vp, &va, td->td_ucred, td); + (void)VOP_GETATTR(vp, &va, td->td_ucred +#if VOP_GETATTR_TAKES_THREAD + , td +#endif + ); } *vpp = vp; #if _DEBUG2G @@ -678,12 +704,18 @@ } static int +#if VFSOPS_TAKES_THREAD fuse_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) { +#else +fuse_statfs(struct mount *mp, struct statfs *sbp) +{ + struct thread *td = curthread; +#endif struct fuse_dispatcher fdi; struct fuse_statfs_out *fsfo; struct fuse_data *data; - int err = 0; + int err = 0; DEBUG2G("mp %p: %s\n", mp, mp->mnt_stat.f_mntfromname); data = fusefs_get_data(mp); @@ -696,7 +728,11 @@ sx_slock(&data->mhierlock); if (data->mpri == FM_PRIMARY) - err = fuse_statfs(data->mp, sbp, td); + err = fuse_statfs(data->mp, sbp +#if VFSOPS_TAKES_THREAD + , td +#endif + ); else err = ENXIO; sx_sunlock(&data->mhierlock); @@ -752,14 +788,20 @@ */ sbp->f_bsize = fsfo->st.bsize; /* cast from uint32_t to uint64_t */ - DEBUG("fuse_statfs_out -- blocks: %llu, bfree: %llu, bavail: %llu, files: %llu, ffree: %llu, bsize: %i, namelen: %i\n", - (unsigned long long)fsfo->st.blocks, (unsigned long long)fsfo->st.bfree, (unsigned long long)fsfo->st.bavail, (unsigned long long)fsfo->st.files, (unsigned long long)fsfo->st.ffree, fsfo->st.bsize, fsfo->st.namelen); + DEBUG("fuse_statfs_out -- blocks: %llu, bfree: %llu, bavail: %llu," + "files: %llu, ffree: %llu, bsize: %i, namelen: %i\n", + (unsigned long long)fsfo->st.blocks, + (unsigned long long)fsfo->st.bfree, + (unsigned long long)fsfo->st.bavail, + (unsigned long long)fsfo->st.files, + (unsigned long long)fsfo->st.ffree, fsfo->st.bsize, + fsfo->st.namelen); fuse_ticket_drop(fdi.tick); return (0); fake: - sbp->f_blocks = 0; + sbp->f_blocks = 0; sbp->f_bfree = 0; sbp->f_bavail = 0; sbp->f_files = 0; @@ -777,8 +819,8 @@ int fuse_vget_i(struct mount *mp, struct thread *td, uint64_t nodeid, - enum vtype vtyp, struct vnode **vpp, enum vget_mode vmod, - uint64_t parentid) + enum vtype vtyp, struct vnode **vpp, enum vget_mode vmod, + uint64_t parentid) { #define myflags LK_EXCLUSIVE | LK_RETRY int err = 0; @@ -786,7 +828,7 @@ struct vnode *vp2; DEBUG("been asked for vno #%llu, parent #%llu\n", - (long long unsigned)nodeid, (long long unsigned)parentid); + (long long unsigned)nodeid, (long long unsigned)parentid); if (vtyp == VNON) return (EINVAL); @@ -794,7 +836,11 @@ if (nodeid == FUSE_ROOT_ID) { if (parentid != FUSE_NULL_ID) return (ENOENT); - err = VFS_ROOT(mp, myflags, vpp, td); + err = VFS_ROOT(mp, myflags, vpp +#if VFSOPS_TAKES_THREAD + , td +#endif + ); if (err) return (err); KASSERT(*vpp, ("we neither err'd nor found the root node")); @@ -809,7 +855,7 @@ if (vmod == VG_WANTNEW) *vpp = NULL; else if ((err = vfs_hash_get(mp, nodeid, /*flags*/ myflags, td, vpp, - fuse_vnode_cmp, &nodeid))) + fuse_vnode_cmp, &nodeid))) return (err); /* @@ -842,11 +888,10 @@ pmp.parent_nid = parentid; pmp.valid = 0; err = vfs_hash_get(mp, pmp.nodeid, 0, - td, &xvp, - fuse_vnode_setparent_cmp, - &pmp); + td, &xvp, + fuse_vnode_setparent_cmp, &pmp); KASSERT(xvp == NULL, - ("findparent routine has fetched a vnode")); + ("findparent routine has fetched a vnode")); } else /* parent mismatch for a directory */ err = EIO; @@ -882,25 +927,25 @@ #endif if (err) { - free(fvdat, M_FUSEVN); + free(fvdat, M_FUSEVN); VNASSERT(! *vpp, *vpp, - ("Maybe I misunderstood how getnewvnode() works...")); - return (err); + ("Maybe I misunderstood how getnewvnode() works...")); + return (err); } #if NEW_VNODES_ADJUSTED_MANUALLY err = vn_lock(*vpp, myflags #if VN_LOCK_TAKES_THREAD - , td + , td #endif - ); + ); if (err) printf("fuse4bsd: leaking vnode %p\n", *vpp); else err = insmntque(*vpp, mp); if (err) { - free(fvdat, M_FUSEVN); - return (err); + free(fvdat, M_FUSEVN); + return (err); } #endif @@ -912,7 +957,7 @@ */ fuse_vnode_init(*vpp, fvdat, nodeid, vtyp, parentid); err = vfs_hash_insert(*vpp, nodeid, /*flags*/ myflags, td, &vp2, - fuse_vnode_bgdrop_cmp, fvdat); + fuse_vnode_bgdrop_cmp, fvdat); if (err) { free(fvdat, M_FUSEVN); @@ -923,7 +968,8 @@ } if (vp2) { - DEBUG("gee, vfs hash collision for node #%llu\n", (unsigned long long)nodeid); + DEBUG("gee, vfs hash collision for node #%llu\n", + (unsigned long long)nodeid); if (vmod == VG_WANTNEW) { vput(vp2); *vpp = NULL; >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107310438.p6V4clu7082758>