Submit #2471

[PATCH] kernel -- ffs: Fix soft updates MKDIR_BODY buffer processing panic.

Added by me1 over 1 year ago. Updated over 1 year ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Fix is from OpenBSD ffs_softdep.c v1.79, originally from FreeBSD
ffs_softdep.c 1.196. Commit message from OpenBSD:

"due to ffs_sync not be able to sync some buffers here is another
instance of softdep code that must ensure proper syncing.
try harder to flush MKDIR_BODY dependancy if such still exists
during pagedep flush (that is by syncing first block of the dir)."
---
sys/vfs/ufs/ffs_softdep.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/sys/vfs/ufs/ffs_softdep.c b/sys/vfs/ufs/ffs_softdep.c
index 942245c..d2e43b6 100644
--- a/sys/vfs/ufs/ffs_softdep.c
+++ b/sys/vfs/ufs/ffs_softdep.c
@@ -4527,6 +4527,7 @@ flush_pagedep_deps(struct vnode *pvp, struct mount *mp,
struct inodedep *inodedep;
struct ufsmount *ump;
struct diradd *dap;
+ struct worklist *wk;
struct vnode *vp;
int gotit, error = 0;
struct buf *bp;
@@ -4575,7 +4576,32 @@ flush_pagedep_deps(struct vnode *pvp, struct mount *mp,
break;
}
drain_output(vp, 0);
+ /*
+ * If first block is still dirty with a D_MKDIR
+ * dependency then it needs to be written now.
+ */
+ error = 0;
+ ACQUIRE_LOCK(&lk);
+ bp = findblk(vp, 0, FINDBLK_TEST);
+ if (bp == NULL) {
+ FREE_LOCK(&lk);
+ goto mkdir_body_continue;
+ }
+ LIST_FOREACH(wk, &bp->b_dep, wk_list)
+ if (wk->wk_type == D_MKDIR) {
+ gotit = getdirtybuf(&bp, MNT_WAIT);
+ FREE_LOCK(&lk);
+ if (gotit && (error = bwrite(bp)) != 0)
+ goto mkdir_body_continue;
+ break;
+ }
+ if (wk == NULL)
+ FREE_LOCK(&lk);
+ mkdir_body_continue:
vput(vp);
+ /* Flushing of first block failed. */
+ if (error)
+ break;
ACQUIRE_LOCK(&lk);
/*
* If that cleared dependencies, go on to next.
--
1.7.7.2

History

#1 Updated by vsrinivas over 1 year ago

  • Status changed from New to Closed

Committed by dillon@ as 01a04a60873088916e4c5bcd230359c3ca654a9d.

Also available in: Atom PDF