Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 May 2021 18:23:58 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: de1b69aec286 - stable/13 - vfs: add missing atomic conversion to writecount adjustment
Message-ID:  <202105221823.14MINwXu005901@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=de1b69aec28617ffa6b0c3554ec78e7a87eb27a5

commit de1b69aec28617ffa6b0c3554ec78e7a87eb27a5
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-05-14 15:41:39 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-05-22 18:22:16 +0000

    vfs: add missing atomic conversion to writecount adjustment
    
    Fixes:  ("vfs: lockless writecount adjustment in set/unset text")
    (cherry picked from commit 852088f6af6c5cd44542dde72aa5c3f4c4f9353c)
---
 sys/kern/vfs_default.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index eb584feb6c41..5a233603631e 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -1210,7 +1210,7 @@ vop_stdset_text(struct vop_set_text_args *ap)
 			vrefl(vp);
 		}
 
-		vp->v_writecount--;
+		atomic_subtract_int(&vp->v_writecount, 1);
 		error = 0;
 	}
 	VI_UNLOCK(vp);
@@ -1247,7 +1247,7 @@ vop_stdunset_text(struct vop_unset_text_args *ap)
 			last = true;
 			vp->v_iflag &= ~VI_TEXT_REF;
 		}
-		vp->v_writecount++;
+		atomic_add_int(&vp->v_writecount, 1);
 		error = 0;
 	} else {
 		error = EINVAL;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105221823.14MINwXu005901>