Page MenuHomeFreeBSD

D47523.diff
No OneTemporary

D47523.diff

diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -2304,10 +2304,10 @@
int
bufwrite(struct buf *bp)
{
- int oldflags;
struct vnode *vp;
long space;
- int vp_md;
+ int oldflags, retval;
+ bool vp_md;
CTR3(KTR_BUF, "bufwrite(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags);
if ((bp->b_bufobj->bo_flag & BO_DEAD) != 0) {
@@ -2316,24 +2316,21 @@
brelse(bp);
return (ENXIO);
}
- if (bp->b_flags & B_INVAL) {
+ if ((bp->b_flags & B_INVAL) != 0) {
brelse(bp);
return (0);
}
- if (bp->b_flags & B_BARRIER)
+ if ((bp->b_flags & B_BARRIER) != 0)
atomic_add_long(&barrierwrites, 1);
oldflags = bp->b_flags;
- KASSERT(!(bp->b_vflags & BV_BKGRDINPROG),
+ KASSERT((bp->b_vflags & BV_BKGRDINPROG) == 0,
("FFS background buffer should not get here %p", bp));
vp = bp->b_vp;
- if (vp)
- vp_md = vp->v_vflag & VV_MD;
- else
- vp_md = 0;
+ vp_md = vp != NULL && (vp->v_vflag & VV_MD) != 0;
/*
* Mark the buffer clean. Increment the bufobj write count
@@ -2365,24 +2362,22 @@
}
#endif /* RACCT */
curthread->td_ru.ru_oublock++;
- if (oldflags & B_ASYNC)
+ if ((oldflags & B_ASYNC) != 0)
BUF_KERNPROC(bp);
bp->b_iooffset = dbtob(bp->b_blkno);
buf_track(bp, __func__);
bstrategy(bp);
if ((oldflags & B_ASYNC) == 0) {
- int rtval = bufwait(bp);
+ retval = bufwait(bp);
brelse(bp);
- return (rtval);
+ return (retval);
} else if (space > hirunningspace) {
/*
- * don't allow the async write to saturate the I/O
- * system. We will not deadlock here because
- * we are blocking waiting for I/O that is already in-progress
- * to complete. We do not block here if it is the update
- * or syncer daemon trying to clean up as that can lead
- * to deadlock.
+ * Don't allow the async write to saturate the I/O
+ * system. We do not block here if it is the update
+ * or syncer daemon trying to clean up as that can
+ * lead to deadlock.
*/
if ((curthread->td_pflags & TDP_NORUNNINGBUF) == 0 && !vp_md)
waitrunningbufspace();
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -3630,6 +3630,7 @@
int cnt;
int off;
int devbsize;
+ int savef;
ump = VFSTOUFS(mp);
if (ump->um_softdep == NULL || ump->um_softdep->sd_jblocks == NULL)
@@ -3641,6 +3642,8 @@
fs = ump->um_fs;
jblocks = ump->softdep_jblocks;
devbsize = ump->um_devvp->v_bufobj.bo_bsize;
+ savef = curthread_pflags_set(TDP_NORUNNINGBUF);
+
/*
* We write anywhere between a disk block and fs block. The upper
* bound is picked to prevent buffer cache fragmentation and limit
@@ -3859,12 +3862,15 @@
*/
if (flags == 0 && jblocks->jb_suspended) {
if (journal_unsuspend(ump))
- return;
+ goto out;
FREE_LOCK(ump);
VFS_SYNC(mp, MNT_NOWAIT);
ffs_sbupdate(ump, MNT_WAIT, 0);
ACQUIRE_LOCK(ump);
}
+
+out:
+ curthread_pflags_restore(savef);
}
/*

File Metadata

Mime Type
text/plain
Expires
Fri, Feb 27, 3:09 PM (3 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29033930
Default Alt Text
D47523.diff (2 KB)

Event Timeline