git: d0929a990c80 - main - ffs: reduce number of dvp relocks in softdep_prelink()
Konstantin Belousov
kib at FreeBSD.org
Wed Jun 23 20:47:28 UTC 2021
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=d0929a990c80b78bc84326234cf54cd4382d42fd
commit d0929a990c80b78bc84326234cf54cd4382d42fd
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-04-29 22:21:33 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-06-23 20:46:15 +0000
ffs: reduce number of dvp relocks in softdep_prelink()
If vp == NULL, we unlocked and then immediately relocked dvp there.
Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041
---
sys/ufs/ffs/ffs_softdep.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 23c0cf6e128b..2a76ec41f03d 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -3415,10 +3415,9 @@ softdep_prelink(dvp, vp)
if (vp != NULL)
VOP_UNLOCK(vp);
ffs_syncvnode(dvp, MNT_WAIT, 0);
- VOP_UNLOCK(dvp);
-
/* Process vp before dvp as it may create .. removes. */
if (vp != NULL) {
+ VOP_UNLOCK(dvp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
if (vp->v_data == NULL) {
vn_lock_pair(dvp, false, vp, true);
@@ -3429,12 +3428,11 @@ softdep_prelink(dvp, vp)
process_truncates(vp);
FREE_LOCK(ump);
VOP_UNLOCK(vp);
- }
-
- vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
- if (dvp->v_data == NULL) {
- vn_lock_pair(dvp, true, vp, false);
- return (ERELOOKUP);
+ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
+ if (dvp->v_data == NULL) {
+ vn_lock_pair(dvp, true, vp, false);
+ return (ERELOOKUP);
+ }
}
ACQUIRE_LOCK(ump);
More information about the dev-commits-src-main
mailing list