Handle ERELOOKUP from VOP_FSYNC() in several other places
We need to repeat the operation if the vnode was relocked. Reported and reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38114
This commit is contained in:
parent
70e1b11216
commit
6189672e60
@ -917,11 +917,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);
|
||||
} else if (bp->bio_cmd == BIO_DELETE) {
|
||||
error = vn_deallocate(vp, &off, &len, 0,
|
||||
|
@ -1233,8 +1233,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)
|
||||
|
Loading…
Reference in New Issue
Block a user