aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-01-30 19:17:29 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-02-12 01:02:21 +0000
commitb59a8e63d6bf9092419b7a421c655d0ae2099662 (patch)
treebc59d2f1a5f960afee30030b8f2a48dfece3873c /sys/ufs
parent6aed2435c8bf1fa55891c7d30186c9ad91064da8 (diff)
downloadsrc-b59a8e63d6bf9092419b7a421c655d0ae2099662.tar.gz
src-b59a8e63d6bf9092419b7a421c655d0ae2099662.zip
Stop ignoring ERELOOKUP from VOP_INACTIVE()
When possible, relock the vnode and retry inactivation. Only vunref() is required not to drop the vnode lock, so handle it specially by not retrying. This is a part of the efforts to ensure that unlinked not referenced vnode does not prevent inode from reusing. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index b5daec14decf..72c8061917d8 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -2595,6 +2595,7 @@ process_deferred_inactive(struct mount *mp)
continue;
}
vholdl(vp);
+retry_vnode:
error = vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK);
if (error != 0) {
vdrop(vp);
@@ -2609,7 +2610,12 @@ process_deferred_inactive(struct mount *mp)
UFS_INODE_SET_FLAG(ip, IN_MODIFIED);
}
VI_LOCK(vp);
- vinactive(vp);
+ error = vinactive(vp);
+ if (error == ERELOOKUP && vp->v_usecount == 0) {
+ VI_UNLOCK(vp);
+ VOP_UNLOCK(vp);
+ goto retry_vnode;
+ }
VI_UNLOCK(vp);
VOP_UNLOCK(vp);
vdrop(vp);