View | Details | Raw Unified | Return to bug 230258 | Differences between
and this patch

Collapse All | Expand All

(-)sys/fs/fuse/fuse_io.c (-2 / +2 lines)
Lines 596-603 Link Here
596
			break;
596
			break;
597
	} while (uio->uio_resid > 0 && n > 0);
597
	} while (uio->uio_resid > 0 && n > 0);
598
598
599
	if (fuse_sync_resize && (fvdat->flag & FN_SIZECHANGE) != 0)
599
//	if (fuse_sync_resize && (fvdat->flag & FN_SIZECHANGE) != 0)
600
		fuse_vnode_savesize(vp, cred);
600
//		fuse_vnode_savesize(vp, cred);
601
601
602
	return (err);
602
	return (err);
603
}
603
}
(-)sys/fs/fuse/fuse_node.c (-1 / +3 lines)
Lines 304-309 Link Here
304
	}
304
	}
305
}
305
}
306
306
307
#if 0
307
int
308
int
308
fuse_vnode_savesize(struct vnode *vp, struct ucred *cred)
309
fuse_vnode_savesize(struct vnode *vp, struct ucred *cred)
309
{
310
{
Lines 366-371 Link Here
366
	VOP_GETATTR(vp, &va, cred);
367
	VOP_GETATTR(vp, &va, cred);
367
	FS_DEBUG("refreshed file size: %jd\n", (intmax_t)VTOFUD(vp)->filesize);
368
	FS_DEBUG("refreshed file size: %jd\n", (intmax_t)VTOFUD(vp)->filesize);
368
}
369
}
370
#endif
369
371
370
int
372
int
371
fuse_vnode_setsize(struct vnode *vp, struct ucred *cred, off_t newsize)
373
fuse_vnode_setsize(struct vnode *vp, struct ucred *cred, off_t newsize)
Lines 381-387 Link Here
381
383
382
	oldsize = fvdat->filesize;
384
	oldsize = fvdat->filesize;
383
	fvdat->filesize = newsize;
385
	fvdat->filesize = newsize;
384
	fvdat->flag |= FN_SIZECHANGE;
386
//	fvdat->flag |= FN_SIZECHANGE;
385
387
386
	if (newsize < oldsize) {
388
	if (newsize < oldsize) {
387
		err = vtruncbuf(vp, cred, newsize, fuse_iosize(vp));
389
		err = vtruncbuf(vp, cred, newsize, fuse_iosize(vp));
(-)sys/fs/fuse/fuse_node.h (-1 / +1 lines)
Lines 68-74 Link Here
68
#define FN_REVOKED           0x00000020
68
#define FN_REVOKED           0x00000020
69
#define FN_FLUSHINPROG       0x00000040
69
#define FN_FLUSHINPROG       0x00000040
70
#define FN_FLUSHWANT         0x00000080
70
#define FN_FLUSHWANT         0x00000080
71
#define FN_SIZECHANGE        0x00000100
71
// #define FN_SIZECHANGE        0x00000100
72
#define FN_DIRECTIO          0x00000200
72
#define FN_DIRECTIO          0x00000200
73
73
74
struct fuse_vnode_data {
74
struct fuse_vnode_data {
(-)sys/fs/fuse/fuse_vnops.c (-13 / +27 lines)
Lines 302-310 Link Here
302
			      " (fflag=0x%x)\n",
302
			      " (fflag=0x%x)\n",
303
			      fufh_type, fflag);
303
			      fufh_type, fflag);
304
	}
304
	}
305
	if ((VTOFUD(vp)->flag & FN_SIZECHANGE) != 0) {
305
//	if ((VTOFUD(vp)->flag & FN_SIZECHANGE) != 0) {
306
		fuse_vnode_savesize(vp, cred);
306
//		fuse_vnode_savesize(vp, cred);
307
	}
307
//	}
308
	return 0;
308
	return 0;
309
}
309
}
310
310
Lines 527-536 Link Here
527
		err = ENOENT;
527
		err = ENOENT;
528
		goto out;
528
		goto out;
529
	}
529
	}
530
	if ((fvdat->flag & FN_SIZECHANGE) != 0)
530
//	if ((fvdat->flag & FN_SIZECHANGE) != 0)
531
		vap->va_size = fvdat->filesize;
531
//		vap->va_size = fvdat->filesize;
532
532
533
	if (vnode_isreg(vp) && (fvdat->flag & FN_SIZECHANGE) == 0) {
533
	if (vnode_isreg(vp)/* && (fvdat->flag & FN_SIZECHANGE) == 0*/) {
534
		/*
534
		/*
535
	         * This is for those cases when the file size changed without us
535
	         * This is for those cases when the file size changed without us
536
	         * knowing, and we want to catch up.
536
	         * knowing, and we want to catch up.
Lines 578-586 Link Here
578
		fufh = &(fvdat->fufh[type]);
578
		fufh = &(fvdat->fufh[type]);
579
		if (FUFH_IS_VALID(fufh)) {
579
		if (FUFH_IS_VALID(fufh)) {
580
			if (need_flush && vp->v_type == VREG) {
580
			if (need_flush && vp->v_type == VREG) {
581
				if ((VTOFUD(vp)->flag & FN_SIZECHANGE) != 0) {
581
//				if ((VTOFUD(vp)->flag & FN_SIZECHANGE) != 0) {
582
					fuse_vnode_savesize(vp, NULL);
582
//					fuse_vnode_savesize(vp, NULL);
583
				}
583
//				}
584
				if (fuse_data_cache_invalidate ||
584
				if (fuse_data_cache_invalidate ||
585
				    (fvdat->flag & FN_REVOKED) != 0)
585
				    (fvdat->flag & FN_REVOKED) != 0)
586
					fuse_io_invalbuf(vp, td);
586
					fuse_io_invalbuf(vp, td);
Lines 823-828 Link Here
823
823
824
		struct fuse_entry_out *feo = NULL;
824
		struct fuse_entry_out *feo = NULL;
825
		struct fuse_attr *fattr = NULL;
825
		struct fuse_attr *fattr = NULL;
826
		struct fuse_vnode_data *fvdat = NULL;
826
827
827
		if (op == FUSE_GETATTR) {
828
		if (op == FUSE_GETATTR) {
828
			fattr = &((struct fuse_attr_out *)fdi.answ)->attr;
829
			fattr = &((struct fuse_attr_out *)fdi.answ)->attr;
Lines 971-976 Link Here
971
			cache_attrs(*vpp, (struct fuse_entry_out *)fdi.answ);
972
			cache_attrs(*vpp, (struct fuse_entry_out *)fdi.answ);
972
		}
973
		}
973
974
975
		fvdat = VTOFUD(*vpp);
976
977
		if (vnode_isreg(*vpp)/* && (fvdat->flag & FN_SIZECHANGE) == 0*/) {
978
			/*
979
			 * This is for those cases when the file size changed without us
980
			 * knowing, and we want to catch up.
981
			 */
982
			off_t new_filesize = fattr->size;
983
984
			if (fvdat->filesize != new_filesize) {
985
				fuse_vnode_setsize(*vpp, cred, new_filesize);
986
			}
987
		}
974
		/* Insert name into cache if appropriate. */
988
		/* Insert name into cache if appropriate. */
975
989
976
		/*
990
		/*
Lines 1652-1658 Link Here
1652
	fdisp_destroy(&fdi);
1666
	fdisp_destroy(&fdi);
1653
	if (!err && sizechanged) {
1667
	if (!err && sizechanged) {
1654
		fuse_vnode_setsize(vp, cred, newsize);
1668
		fuse_vnode_setsize(vp, cred, newsize);
1655
		VTOFUD(vp)->flag &= ~FN_SIZECHANGE;
1669
//		VTOFUD(vp)->flag &= ~FN_SIZECHANGE;
1656
	}
1670
	}
1657
	return err;
1671
	return err;
1658
}
1672
}
Lines 1677-1684 Link Here
1677
		bufdone(bp);
1691
		bufdone(bp);
1678
		return ENXIO;
1692
		return ENXIO;
1679
	}
1693
	}
1680
	if (bp->b_iocmd == BIO_WRITE)
1694
//	if (bp->b_iocmd == BIO_WRITE)
1681
		fuse_vnode_refreshsize(vp, NOCRED);
1695
//		fuse_vnode_refreshsize(vp, NOCRED);
1682
1696
1683
	(void)fuse_io_strategy(vp, bp);
1697
	(void)fuse_io_strategy(vp, bp);
1684
1698
Lines 1765-1771 Link Here
1765
	if (fuse_isdeadfs(vp)) {
1779
	if (fuse_isdeadfs(vp)) {
1766
		return ENXIO;
1780
		return ENXIO;
1767
	}
1781
	}
1768
	fuse_vnode_refreshsize(vp, cred);
1782
//	fuse_vnode_refreshsize(vp, cred);
1769
1783
1770
	if (VTOFUD(vp)->flag & FN_DIRECTIO) {
1784
	if (VTOFUD(vp)->flag & FN_DIRECTIO) {
1771
		ioflag |= IO_DIRECT;
1785
		ioflag |= IO_DIRECT;

Return to bug 230258