The softdep code path is missing a UVM cache invalidation compared to
the !softdep one.  This is necessary to flush pages of a persisting
vnode.

Since uvm_vnp_setsize() is also called later in this function for the
!softdep case move it to not call it twice.

ok?

Index: ufs/ffs/ffs_inode.c
===================================================================
RCS file: /cvs/src/sys/ufs/ffs/ffs_inode.c,v
retrieving revision 1.81
diff -u -p -r1.81 ffs_inode.c
--- ufs/ffs/ffs_inode.c 12 Dec 2021 09:14:59 -0000      1.81
+++ ufs/ffs/ffs_inode.c 4 May 2022 15:32:15 -0000
@@ -172,11 +172,12 @@ ffs_truncate(struct inode *oip, off_t le
        if (length > fs->fs_maxfilesize)
                return (EFBIG);
 
-       uvm_vnp_setsize(ovp, length);
        oip->i_ci.ci_lasta = oip->i_ci.ci_clen 
            = oip->i_ci.ci_cstart = oip->i_ci.ci_lastw = 0;
 
        if (DOINGSOFTDEP(ovp)) {
+               uvm_vnp_setsize(ovp, length);
+               (void) uvm_vnp_uncache(ovp);
                if (length > 0 || softdep_slowdown(ovp)) {
                        /*
                         * If a file is only partially truncated, then

Reply via email to