svn commit: r345582 - projects/fuse2/sys/fs/fuse
Alan Somers
asomers at FreeBSD.org
Wed Mar 27 16:45:31 UTC 2019
Author: asomers
Date: Wed Mar 27 16:45:30 2019
New Revision: 345582
URL: https://svnweb.freebsd.org/changeset/base/345582
Log:
fusefs: don't ignore errors in fuse_vnode_refreshsize
Reported by: Coverity
Coverity CID: 1368622
Sponsored by: The FreeBSD Foundation
Modified:
projects/fuse2/sys/fs/fuse/fuse_node.c
projects/fuse2/sys/fs/fuse/fuse_node.h
projects/fuse2/sys/fs/fuse/fuse_vnops.c
Modified: projects/fuse2/sys/fs/fuse/fuse_node.c
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_node.c Wed Mar 27 16:26:03 2019 (r345581)
+++ projects/fuse2/sys/fs/fuse/fuse_node.c Wed Mar 27 16:45:30 2019 (r345582)
@@ -392,20 +392,22 @@ fuse_vnode_savesize(struct vnode *vp, struct ucred *cr
return err;
}
-void
+int
fuse_vnode_refreshsize(struct vnode *vp, struct ucred *cred)
{
struct fuse_vnode_data *fvdat = VTOFUD(vp);
struct vattr va;
+ int err;
if ((fvdat->flag & FN_SIZECHANGE) != 0 ||
fuse_data_cache_mode == FUSE_CACHE_UC ||
(fuse_refresh_size == 0 && fvdat->filesize != 0))
- return;
+ return 0;
- VOP_GETATTR(vp, &va, cred);
+ err = VOP_GETATTR(vp, &va, cred);
SDT_PROBE2(fuse, , node, trace, 1, "refreshed file size");
+ return err;
}
int
Modified: projects/fuse2/sys/fs/fuse/fuse_node.h
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_node.h Wed Mar 27 16:26:03 2019 (r345581)
+++ projects/fuse2/sys/fs/fuse/fuse_node.h Wed Mar 27 16:45:30 2019 (r345582)
@@ -123,7 +123,7 @@ int fuse_vnode_get(struct mount *mp, struct fuse_entry
void fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags,
struct thread *td);
-void fuse_vnode_refreshsize(struct vnode *vp, struct ucred *cred);
+int fuse_vnode_refreshsize(struct vnode *vp, struct ucred *cred);
int fuse_vnode_savesize(struct vnode *vp, struct ucred *cred);
Modified: projects/fuse2/sys/fs/fuse/fuse_vnops.c
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_vnops.c Wed Mar 27 16:26:03 2019 (r345581)
+++ projects/fuse2/sys/fs/fuse/fuse_vnops.c Wed Mar 27 16:45:30 2019 (r345582)
@@ -1712,20 +1712,23 @@ fuse_vnop_strategy(struct vop_strategy_args *ap)
bufdone(bp);
return ENXIO;
}
- if (bp->b_iocmd == BIO_WRITE)
- fuse_vnode_refreshsize(vp, NOCRED);
+ if (bp->b_iocmd == BIO_WRITE) {
+ int err;
- (void)fuse_io_strategy(vp, bp);
+ err = fuse_vnode_refreshsize(vp, NOCRED);
+ if (err) {
+ bp->b_ioflags |= BIO_ERROR;
+ bp->b_error = err;
+ return 0;
+ }
+ }
/*
- * This is a dangerous function. If returns error, that might mean a
- * panic. We prefer pretty much anything over being forced to panic
- * by a malicious daemon (a demon?). So we just return 0 anyway. You
- * should never mind this: this function has its own error
- * propagation mechanism via the argument buffer, so
- * not-that-melodramatic residents of the call chain still will be
- * able to know what to do.
+ * VOP_STRATEGY always returns zero and signals error via bp->b_ioflags.
+ * fuse_io_strategy sets bp's error fields
*/
+ (void)fuse_io_strategy(vp, bp);
+
return 0;
}
@@ -1791,11 +1794,14 @@ fuse_vnop_write(struct vop_write_args *ap)
struct uio *uio = ap->a_uio;
int ioflag = ap->a_ioflag;
struct ucred *cred = ap->a_cred;
+ int err;
if (fuse_isdeadfs(vp)) {
return ENXIO;
}
- fuse_vnode_refreshsize(vp, cred);
+ err = fuse_vnode_refreshsize(vp, cred);
+ if (err)
+ return err;
if (VTOFUD(vp)->flag & FN_DIRECTIO) {
ioflag |= IO_DIRECT;
More information about the svn-src-projects
mailing list