ffs_syncvnode(): avoid a LoR for SU

There is another case where SU code does ffs_syncvnode(dvp) for the
parent directory dvp while the child vnode vp is locked.  Avoid the
issue by relocking and returning ERELOOKUP to indicate the need of
resync.

Reported by:	jkim
Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37997
This commit is contained in:
Konstantin Belousov 2023-01-07 14:22:18 +02:00
parent 1d9f3a37eb
commit 6e1eabadcb

View file

@ -12758,9 +12758,15 @@ softdep_fsync(
pagedep_new_block = pagedep->pd_state & NEWBLOCK;
FREE_LOCK(ump);
locked = 0;
if (pagedep_new_block && (error =
ffs_syncvnode(pvp, MNT_WAIT, 0))) {
if (pagedep_new_block) {
VOP_UNLOCK(vp);
error = ffs_syncvnode(pvp,
MNT_WAIT, 0);
if (error == 0)
error = ERELOOKUP;
vput(pvp);
vn_lock(vp, LK_EXCLUSIVE |
LK_RETRY);
return (error);
}
}