diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-09-11 16:06:02 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-09-11 16:06:02 +0000 |
commit | f116834e8ab76753fa66307d922f267abe51f51b (patch) | |
tree | d34dcc739328fa757dcae0e1b2f503acbde78dd0 /sys | |
parent | 76bf9feda8bb1ef3a76fba15c2be74ac4c0f4bea (diff) |
issue a NOTE_TRUNCATE if the file size has shrinked
ok tedu@, blambert@, art@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/nfs/nfs_kq.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/nfs/nfs_kq.c b/sys/nfs/nfs_kq.c index bf98a6056cc..54562628d4e 100644 --- a/sys/nfs/nfs_kq.c +++ b/sys/nfs/nfs_kq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_kq.c,v 1.13 2008/08/20 12:08:04 thib Exp $ */ +/* $OpenBSD: nfs_kq.c,v 1.14 2008/09/11 16:06:01 thib Exp $ */ /* $NetBSD: nfs_kq.c,v 1.7 2003/10/30 01:43:10 simonb Exp $ */ /*- @@ -134,9 +134,14 @@ nfs_kqpoll(void *arg) /* following is a bit fragile, but about best * we can get */ if (attr.va_size != osize) { - int extended = (attr.va_size > osize); - VN_KNOTE(ke->vp, NOTE_WRITE - | (extended ? NOTE_EXTEND : 0)); + int flags = NOTE_WRITE; + + if (attr.va_size > osize) + flags |= NOTE_EXTEND; + else + flags |= NOTE_TRUNCATE; + + VN_KNOTE(ke->vp, flags); ke->omtime = attr.va_mtime; } else if (attr.va_mtime.tv_sec != ke->omtime.tv_sec || attr.va_mtime.tv_nsec != ke->omtime.tv_nsec) { |