git: 7c09d62011bb - stable/13 - Handle ERELOOKUP from VOP_FSYNC() in several other places
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 22 Jan 2023 09:19:22 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=7c09d62011bb084d3f7127edf2942bf6c9c3a6e2
commit 7c09d62011bb084d3f7127edf2942bf6c9c3a6e2
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-01-18 21:09:10 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-01-22 09:18:09 +0000
Handle ERELOOKUP from VOP_FSYNC() in several other places
(cherry picked from commit 6189672e600814fec4cc165d25ae050fb2f3a999)
---
sys/dev/md/md.c | 12 +++++++-----
sys/vm/vm_object.c | 19 +++++++++++++++++--
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index f44a2e940faa..243ac2be72d9 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -911,11 +911,13 @@ mdstart_vnode(struct md_s *sc, struct bio *bp)
*/
if (bp->bio_cmd == BIO_FLUSH) {
- (void) vn_start_write(vp, &mp, V_WAIT);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- error = VOP_FSYNC(vp, MNT_WAIT, td);
- VOP_UNLOCK(vp);
- vn_finished_write(mp);
+ do {
+ (void) vn_start_write(vp, &mp, V_WAIT);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ error = VOP_FSYNC(vp, MNT_WAIT, td);
+ VOP_UNLOCK(vp);
+ vn_finished_write(mp);
+ } while (error == ERELOOKUP);
return (error);
}
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 97803afc40fe..e7097be7b115 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -1254,8 +1254,23 @@ vm_object_sync(vm_object_t object, vm_ooffset_t offset, vm_size_t size,
res = vm_object_page_clean(object, offset, offset + size,
flags);
VM_OBJECT_WUNLOCK(object);
- if (fsync_after)
- error = VOP_FSYNC(vp, MNT_WAIT, curthread);
+ if (fsync_after) {
+ for (;;) {
+ error = VOP_FSYNC(vp, MNT_WAIT, curthread);
+ if (error != ERELOOKUP)
+ break;
+
+ /*
+ * Allow SU/bufdaemon to handle more
+ * dependencies in the meantime.
+ */
+ VOP_UNLOCK(vp);
+ vn_finished_write(mp);
+
+ (void)vn_start_write(vp, &mp, V_WAIT);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ }
+ }
VOP_UNLOCK(vp);
vn_finished_write(mp);
if (error != 0)