summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2017-07-05 17:29:07 +0000
committermarkj <markj@FreeBSD.org>2017-07-05 17:29:07 +0000
commit075a14bf81a958bc369ed77ea3709527ea21a4e3 (patch)
treeb1ef33d68d309c95dce476268c0d0c17fe926fe2 /sys/fs
parente919181f6463a94f18aaffd21b3ef30f6585afd2 (diff)
downloadFreeBSD-src-075a14bf81a958bc369ed77ea3709527ea21a4e3.zip
FreeBSD-src-075a14bf81a958bc369ed77ea3709527ea21a4e3.tar.gz
MFS r320684: MFC r320451 (by cem):
Complete support for the IO_APPEND flag in fuse. Approved by: re (gjb)
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/fuse/fuse_io.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c
index 5ffeb88..1497220 100644
--- a/sys/fs/fuse/fuse_io.c
+++ b/sys/fs/fuse/fuse_io.c
@@ -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, int ioflag,
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 *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))) {
OpenPOWER on IntegriCloud