panic ffs_truncate3 (maybe fuse being evil)
Konstantin Belousov
kostikbel at gmail.com
Wed Feb 3 16:07:51 UTC 2016
On Wed, Feb 03, 2016 at 05:38:50PM +0200, Konstantin Belousov wrote:
> On Tue, Feb 02, 2016 at 06:19:28PM -0500, Rick Macklem wrote:
> > Kostik wrote:
> > > I do think that the IO_UNIT patch fixes some situations where the buffer
> > > can be left on the vnode queue. I did not found any other places so far.
>
> Could you, please, try the following explicit buffer relse patch in
> addition to the IO_UNIT patch ? This is as similar to r174973 for IO_EXT
> ffs2_balloc() as I can do.
Please use this version, for several places in the old patch, rollback is
not needed.
diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c
index 8551085..9f15df5 100644
--- a/sys/ufs/ffs/ffs_balloc.c
+++ b/sys/ufs/ffs/ffs_balloc.c
@@ -654,8 +654,16 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
ffs_blkpref_ufs2(ip, lbn, (int)lbn,
&dp->di_extb[0]), osize, nsize, flags,
cred, &bp);
- if (error)
+ if (error != 0) {
+ /* getblk does truncation, if needed */
+ bp = getblk(vp, -1 - lbn, osize, 0, 0,
+ GB_NOCREAT);
+ if (bp != NULL) {
+ bp->b_xflags |= BX_ALTDATA;
+ brelse(bp);
+ }
return (error);
+ }
bp->b_xflags |= BX_ALTDATA;
if (DOINGSOFTDEP(vp))
softdep_setup_allocext(ip, lbn,
@@ -671,8 +679,17 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
error = ffs_alloc(ip, lbn,
ffs_blkpref_ufs2(ip, lbn, (int)lbn, &dp->di_extb[0]),
nsize, flags, cred, &newb);
- if (error)
+ if (error != 0) {
+ bp = getblk(vp, -1 - lbn, nsize, 0, 0,
+ GB_NOCREAT);
+ if (bp != NULL) {
+ bp->b_xflags |= BX_ALTDATA;
+ bp->b_flags |= B_RELBUF | B_INVAL;
+ bp->b_flags &= ~B_ASYNC;
+ brelse(bp);
+ }
return (error);
+ }
bp = getblk(vp, -1 - lbn, nsize, 0, 0, gbflags);
bp->b_blkno = fsbtodb(fs, newb);
bp->b_xflags |= BX_ALTDATA;
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 5a70e5c..ecc3f9b 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1311,7 +1313,8 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td
/* XXX: I'm not happy about truncating to zero size */
if (ip->i_ea_len < dp->di_extsize)
error = ffs_truncate(vp, 0, IO_EXT, cred);
- error = ffs_extwrite(vp, &luio, IO_EXT | IO_SYNC, cred);
+ error = ffs_extwrite(vp, &luio, IO_EXT | IO_SYNC | IO_UNIT,
+ cred);
}
if (--ip->i_ea_refs == 0) {
free(ip->i_ea_area, M_TEMP);
More information about the freebsd-fs
mailing list