Avoid doing bawrite to initialize inode block while holding cylinder
group block buffer busy. If filesystem has any active snapshots, bawrite can come back trying to allocate new snapshot data block from the same cylinder group and cause deadlock. From FreeBSD Rev. 1.117
This commit is contained in:
parent
ba0b8a3b17
commit
75bdfc0dac
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_alloc.c,v 1.103 2007/10/18 17:39:04 hannken Exp $ */
|
||||
/* $NetBSD: ffs_alloc.c,v 1.104 2007/11/01 06:31:59 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.103 2007/10/18 17:39:04 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.104 2007/11/01 06:31:59 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -1520,6 +1520,7 @@ gotit:
|
|||
* Check to see if we need to initialize more inodes.
|
||||
*/
|
||||
initediblk = ufs_rw32(cgp->cg_initediblk, needswap);
|
||||
ibp = NULL;
|
||||
if (fs->fs_magic == FS_UFS2_MAGIC &&
|
||||
ipref + INOPB(fs) > initediblk &&
|
||||
initediblk < ufs_rw32(cgp->cg_niblk, needswap)) {
|
||||
|
@ -1536,7 +1537,6 @@ gotit:
|
|||
dp2->di_gen = (arc4random() & INT32_MAX) / 2 + 1;
|
||||
dp2++;
|
||||
}
|
||||
bawrite(ibp);
|
||||
initediblk += INOPB(fs);
|
||||
cgp->cg_initediblk = ufs_rw32(initediblk, needswap);
|
||||
}
|
||||
|
@ -1557,6 +1557,8 @@ gotit:
|
|||
if (DOINGSOFTDEP(ITOV(ip)))
|
||||
softdep_setup_inomapdep(bp, ip, cg * fs->fs_ipg + ipref);
|
||||
bdwrite(bp);
|
||||
if (ibp != NULL)
|
||||
bawrite(ibp);
|
||||
return (cg * fs->fs_ipg + ipref);
|
||||
fail:
|
||||
brelse(bp, 0);
|
||||
|
|
Loading…
Reference in New Issue