Deleted Added
full compact
kern_shutdown.c (52128) kern_shutdown.c (53023)
1/*-
2 * Copyright (c) 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
1/*-
2 * Copyright (c) 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
39 * $FreeBSD: head/sys/kern/kern_shutdown.c 52128 1999-10-11 15:19:12Z peter $
39 * $FreeBSD: head/sys/kern/kern_shutdown.c 53023 1999-11-08 19:36:45Z phk $
40 */
41
42#include "opt_ddb.h"
43#include "opt_hw_wdog.h"
44#include "opt_panic.h"
45#include "opt_show_busybufs.h"
46
47#include <sys/param.h>

--- 166 unchanged lines hidden (view full) ---

214 }
215 }
216 if (nbusy == 0)
217 break;
218 printf("%d ", nbusy);
219 sync(&proc0, NULL);
220 DELAY(50000 * iter);
221 }
40 */
41
42#include "opt_ddb.h"
43#include "opt_hw_wdog.h"
44#include "opt_panic.h"
45#include "opt_show_busybufs.h"
46
47#include <sys/param.h>

--- 166 unchanged lines hidden (view full) ---

214 }
215 }
216 if (nbusy == 0)
217 break;
218 printf("%d ", nbusy);
219 sync(&proc0, NULL);
220 DELAY(50000 * iter);
221 }
222 printf("\n");
222 /*
223 * Count only busy local buffers to prevent forcing
224 * a fsck if we're just a client of a wedged NFS server
225 */
226 nbusy = 0;
227 for (bp = &buf[nbuf]; --bp >= buf; ) {
228 if (((bp->b_flags&B_INVAL) == 0 && BUF_REFCNT(bp)) ||
229 ((bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI)) {
223 /*
224 * Count only busy local buffers to prevent forcing
225 * a fsck if we're just a client of a wedged NFS server
226 */
227 nbusy = 0;
228 for (bp = &buf[nbuf]; --bp >= buf; ) {
229 if (((bp->b_flags&B_INVAL) == 0 && BUF_REFCNT(bp)) ||
230 ((bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI)) {
230 if (bp->b_dev == NODEV)
231 if (bp->b_dev == NODEV) {
231 CIRCLEQ_REMOVE(&mountlist,
232 bp->b_vp->v_mount, mnt_list);
232 CIRCLEQ_REMOVE(&mountlist,
233 bp->b_vp->v_mount, mnt_list);
233 else
234 nbusy++;
234 continue;
235 }
236 nbusy++;
237#if defined(SHOW_BUSYBUFS) || defined(DIAGNOSTIC)
238 printf(
239 "%d: dev:%s, flags:%08lx, blkno:%ld, lblkno:%ld\n",
240 nbusy, devtoname(bp->b_dev),
241 bp->b_flags, (long)bp->b_blkno,
242 (long)bp->b_lblkno);
243#endif
235 }
244 }
236
237
238 }
239 if (nbusy) {
240 /*
241 * Failed to sync all blocks. Indicate this and don't
242 * unmount filesystems (thus forcing an fsck on reboot).
243 */
245 }
246 if (nbusy) {
247 /*
248 * Failed to sync all blocks. Indicate this and don't
249 * unmount filesystems (thus forcing an fsck on reboot).
250 */
244 printf("giving up\n");
245#ifdef SHOW_BUSYBUFS
246 nbusy = 0;
247 for (bp = &buf[nbuf]; --bp >= buf; ) {
248 if ((bp->b_flags & B_INVAL) == 0 &&
249 BUF_REFCNT(bp) > 0) {
250 nbusy++;
251 printf(
252 "%d: dev:%s, flags:%08lx, blkno:%ld, lblkno:%ld\n",
253 nbusy, devtoname(bp->b_dev),
254 bp->b_flags, (long)bp->b_blkno,
255 (long)bp->b_lblkno);
256 }
257 }
251 printf("giving up on %d buffers\n", nbusy);
258 DELAY(5000000); /* 5 seconds */
252 DELAY(5000000); /* 5 seconds */
259#endif
260 } else {
261 printf("done\n");
262 /*
263 * Unmount filesystems
264 */
265 if (panicstr == 0)
266 vfs_unmountall();
267 }

--- 279 unchanged lines hidden ---
253 } else {
254 printf("done\n");
255 /*
256 * Unmount filesystems
257 */
258 if (panicstr == 0)
259 vfs_unmountall();
260 }

--- 279 unchanged lines hidden ---