diff options
author | kib <kib@FreeBSD.org> | 2016-05-18 12:03:57 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-05-18 12:03:57 +0000 |
commit | 54336eef75323c51ab0b6399102309818fa3d988 (patch) | |
tree | 0535aad52f106a9434beef2eceb1cb50ad716157 /sys/ufs | |
parent | b56c0ce9bf9e3464e31f8c1cc5cca3a3b265ab91 (diff) | |
download | FreeBSD-src-54336eef75323c51ab0b6399102309818fa3d988.zip FreeBSD-src-54336eef75323c51ab0b6399102309818fa3d988.tar.gz |
Ensure that ftruncate(2) is performed synchronously when file is
opened in O_SYNC mode, at least for UFS. This also handles
truncation, done due to the O_SYNC | O_TRUNC flags combination to
open(2), in synchronous way.
Noted by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index c0729f8..83df347 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -625,7 +625,8 @@ ufs_setattr(ap) */ return (0); } - if ((error = UFS_TRUNCATE(vp, vap->va_size, IO_NORMAL, + if ((error = UFS_TRUNCATE(vp, vap->va_size, IO_NORMAL | + ((vap->va_vaflags & VA_SYNC) != 0 ? IO_SYNC : 0), cred)) != 0) return (error); } |