Date: Fri, 8 Mar 2019 02:00:50 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r344914 - projects/fuse2/sys/fs/fuse Message-ID: <201903080200.x2820oZj023686@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Fri Mar 8 02:00:49 2019 New Revision: 344914 URL: https://svnweb.freebsd.org/changeset/base/344914 Log: fuse(4): add dtrace probe for illegal short writes Sponsored by: The FreeBSD Foundation Modified: projects/fuse2/sys/fs/fuse/fuse_io.c Modified: projects/fuse2/sys/fs/fuse/fuse_io.c ============================================================================== --- projects/fuse2/sys/fs/fuse/fuse_io.c Fri Mar 8 01:17:20 2019 (r344913) +++ projects/fuse2/sys/fs/fuse/fuse_io.c Fri Mar 8 02:00:49 2019 (r344914) @@ -369,13 +369,24 @@ fuse_write_directbackend(struct vnode *vp, struct uio if ((err = fdisp_wait_answ(&fdi))) break; + /* Adjust the uio in the case of short writes */ diff = chunksize - ((struct fuse_write_out *)fdi.answ)->size; if (diff < 0) { err = EINVAL; break; + } else if (diff > 0 && !(ioflag & IO_DIRECT)) { + /* + * XXX We really should be directly checking whether + * the file was opened with FOPEN_DIRECT_IO, not + * IO_DIRECT. IO_DIRECT can be set in multiple ways. + */ + SDT_PROBE2(fuse, , io, trace, 1, + "misbehaving filesystem: short writes are only " + "allowed with direct_io"); } uio->uio_resid += diff; uio->uio_offset -= diff; + if (uio->uio_offset > fvdat->filesize && fuse_data_cache_mode != FUSE_CACHE_UC) { fuse_vnode_setsize(vp, cred, uio->uio_offset);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903080200.x2820oZj023686>