Date: Wed, 28 Jun 2017 13:56:16 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320451 - head/sys/fs/fuse Message-ID: <201706281356.v5SDuGtV033527@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Wed Jun 28 13:56:15 2017 New Revision: 320451 URL: https://svnweb.freebsd.org/changeset/base/320451 Log: Complete support for IO_APPEND flag in fuse This finishes what r245164 started and makes open(..., O_APPEND) work again after r299753. - Pass ioflags, incl. IO_APPEND, down to the direct write backend (r245164 added it to only the bio backend). - (r299753 changed the WRONLY backend from bio to direct.) PR: 220185 Reported by: Ben RUBSON <ben.rubson at gmail.com> Reviewed by: bapt@, rmacklem@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11348 Modified: head/sys/fs/fuse/fuse_io.c Modified: head/sys/fs/fuse/fuse_io.c ============================================================================== --- head/sys/fs/fuse/fuse_io.c Wed Jun 28 09:25:15 2017 (r320450) +++ head/sys/fs/fuse/fuse_io.c Wed Jun 28 13:56:15 2017 (r320451) @@ -108,7 +108,7 @@ fuse_read_biobackend(struct vnode *vp, struct uio *uio struct ucred *cred, struct fuse_filehandle *fufh); static int fuse_write_directbackend(struct vnode *vp, struct uio *uio, - struct ucred *cred, struct fuse_filehandle *fufh); + struct ucred *cred, struct fuse_filehandle *fufh, int ioflag); static int fuse_write_biobackend(struct vnode *vp, struct uio *uio, struct ucred *cred, struct fuse_filehandle *fufh, int ioflag); @@ -156,7 +156,7 @@ fuse_io_dispatch(struct vnode *vp, struct uio *uio, in if (directio) { FS_DEBUG("direct write of vnode %ju via file handle %ju\n", (uintmax_t)VTOILLU(vp), (uintmax_t)fufh->fh_id); - err = fuse_write_directbackend(vp, uio, cred, fufh); + err = fuse_write_directbackend(vp, uio, cred, fufh, ioflag); } else { FS_DEBUG("buffered write of vnode %ju\n", (uintmax_t)VTOILLU(vp)); @@ -318,7 +318,7 @@ out: static int fuse_write_directbackend(struct vnode *vp, struct uio *uio, - struct ucred *cred, struct fuse_filehandle *fufh) + struct ucred *cred, struct fuse_filehandle *fufh, int ioflag) { struct fuse_vnode_data *fvdat = VTOFUD(vp); struct fuse_write_in *fwi; @@ -327,8 +327,10 @@ fuse_write_directbackend(struct vnode *vp, struct uio int diff; int err = 0; - if (!uio->uio_resid) + if (uio->uio_resid == 0) return (0); + if (ioflag & IO_APPEND) + uio_setoffset(uio, fvdat->filesize); fdisp_init(&fdi, 0); @@ -705,7 +707,7 @@ fuse_io_strategy(struct vnode *vp, struct buf *bp) io.iov_base = (char *)bp->b_data + bp->b_dirtyoff; uiop->uio_rw = UIO_WRITE; - error = fuse_write_directbackend(vp, uiop, cred, fufh); + error = fuse_write_directbackend(vp, uiop, cred, fufh, 0); if (error == EINTR || error == ETIMEDOUT || (!error && (bp->b_flags & B_NEEDCOMMIT))) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706281356.v5SDuGtV033527>