diff options
author | jlemon <jlemon@FreeBSD.org> | 2001-02-23 20:06:01 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2001-02-23 20:06:01 +0000 |
commit | 58f9dcd6ced7e1926fc1dae75119651b0913fca2 (patch) | |
tree | f038a4ecc3cbcbcd9165f41d13c01ce15885d48c /sys/ufs | |
parent | 256c4acb0bc88fef2e92bd0e4598774aa206e63c (diff) | |
download | FreeBSD-src-58f9dcd6ced7e1926fc1dae75119651b0913fca2.zip FreeBSD-src-58f9dcd6ced7e1926fc1dae75119651b0913fca2.tar.gz |
Add a NOTE_REVOKE flag for vnodes, which is triggered from within vclean().
Use this to tell a filter attached to a vnode that the underlying vnode is
no longer valid, by returning EV_EOF.
PR: kern/25309, kern/25206
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 29efbcc..870d6dd 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2235,6 +2235,15 @@ filt_ufsread(struct knote *kn, long hint) struct vnode *vp = (struct vnode *)kn->kn_hook; struct inode *ip = VTOI(vp); + /* + * filesystem is gone, so set the EOF flag and schedule + * the knote for deletion. + */ + if (hint == NOTE_REVOKE) { + kn->kn_flags |= (EV_EOF | EV_ONESHOT); + return (1); + } + kn->kn_data = ip->i_size - kn->kn_fp->f_offset; return (kn->kn_data != 0); } @@ -2245,6 +2254,10 @@ filt_ufsvnode(struct knote *kn, long hint) if (kn->kn_sfflags & hint) kn->kn_fflags |= hint; + if (hint == NOTE_REVOKE) { + kn->kn_flags |= EV_EOF; + return (1); + } return (kn->kn_fflags != 0); } |