ufs: be more persistent with finishing some operations

when the vnode is doomed after relock.  The mere fact that the vnode is
doomed does not prevent us from doing UFS operations on it while it is
still belongs to UFS, which is determined by non-NULL v_data.  Not
finishing some operations, e.g. not syncing the inode block only because
the vnode started reclamation, is not correct.

Add macro IS_UFS() which incapsulates the v_data != NULL, and use it
instead of VN_IS_DOOMED() for places where the operation completion is
important.

Reviewed by:	markj, mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34072
This commit is contained in:
Konstantin Belousov 2022-01-18 03:49:36 +02:00
parent 4559700a0a
commit 8d8589b385
4 changed files with 4 additions and 3 deletions

View File

@ -179,7 +179,7 @@ ffs_update(vp, waitfor)
pause("ffsupd", 1);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
vrele(vp);
if (VN_IS_DOOMED(vp))
if (!IS_UFS(vp))
return (ENOENT);
/*

View File

@ -13772,7 +13772,7 @@ softdep_request_cleanup_inactivate(struct mount *mp)
vholdl(vp);
vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK | LK_RETRY);
VI_LOCK(vp);
if (vp->v_data != NULL && vp->v_usecount == 0) {
if (IS_UFS(vp) && vp->v_usecount == 0) {
while ((vp->v_iflag & VI_OWEINACT) != 0) {
error = vinactive(vp);
if (error != 0 && error != ERELOOKUP)

View File

@ -2066,7 +2066,7 @@ ffs_vput_pair(struct vop_vput_pair_args *ap)
* and respond to dead vnodes by returning ESTALE.
*/
VOP_LOCK(vp, vp_locked | LK_RETRY);
if (!VN_IS_DOOMED(vp))
if (IS_UFS(vp))
return (0);
/*

View File

@ -247,6 +247,7 @@ I_IS_UFS2(const struct inode *ip)
} while (0)
#define IS_SNAPSHOT(ip) ((ip)->i_flags & SF_SNAPSHOT)
#define IS_UFS(vp) ((vp)->v_data != NULL)
/*
* Structure used to pass around logical block paths generated by