From 3f11de9ddb9e8b567df284c7f495ac53076611c4 Mon Sep 17 00:00:00 2001 From: Sara Hartse Date: Tue, 29 Nov 2016 13:15:25 -0800 Subject: 7605 we should not attempt to write to ZFS while panicing Reviewed by: Matt Ahrens Reviewed by: Pavel Zakharov Reviewed by: George Wilson Approved by: Dan McDonald --- usr/src/uts/common/fs/vfs.c | 45 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) (limited to 'usr/src/uts/common/fs/vfs.c') diff --git a/usr/src/uts/common/fs/vfs.c b/usr/src/uts/common/fs/vfs.c index 64ed4386a4..56834594fe 100644 --- a/usr/src/uts/common/fs/vfs.c +++ b/usr/src/uts/common/fs/vfs.c @@ -23,6 +23,7 @@ * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2016 Toomas Soome + * Copyright (c) 2016 by Delphix. All rights reserved. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ @@ -4038,9 +4039,6 @@ vfs_unrefvfssw(struct vfssw *vswp) mutex_exit(&vswp->vsw_lock); } -int sync_timeout = 30; /* timeout for syncing a page during panic */ -int sync_timeleft; /* portion of sync_timeout remaining */ - static int sync_retries = 20; /* number of retries when not making progress */ static int sync_triesleft; /* portion of sync_retries remaining */ @@ -4051,23 +4049,13 @@ static int new_bufcnt, old_bufcnt; * Sync all of the mounted filesystems, and then wait for the actual i/o to * complete. We wait by counting the number of dirty pages and buffers, * pushing them out using bio_busy() and page_busy(), and then counting again. - * This routine is used during both the uadmin A_SHUTDOWN code as well as - * the SYNC phase of the panic code (see comments in panic.c). It should only + * This routine is used during the uadmin A_SHUTDOWN code. It should only * be used after some higher-level mechanism has quiesced the system so that * new writes are not being initiated while we are waiting for completion. * - * To ensure finite running time, our algorithm uses two timeout mechanisms: - * sync_timeleft (a timer implemented by the omnipresent deadman() cyclic), and - * sync_triesleft (a progress counter used by the vfs_syncall() loop below). - * Together these ensure that syncing completes if our i/o paths are stuck. - * The counters are declared above so they can be found easily in the debugger. - * - * The sync_timeleft counter is reset by bio_busy() and page_busy() using the - * vfs_syncprogress() subroutine whenever we make progress through the lists of - * pages and buffers. It is decremented and expired by the deadman() cyclic. - * When vfs_syncall() decides it is done, we disable the deadman() counter by - * setting sync_timeleft to zero. This timer guards against vfs_syncall() - * deadlocking or hanging inside of a broken filesystem or driver routine. + * To ensure finite running time, our algorithm uses sync_triesleft (a progress + * counter used by the vfs_syncall() loop below). It is declared above so + * it can be found easily in the debugger. * * The sync_triesleft counter is updated by vfs_syncall() itself. If we make * sync_retries consecutive calls to bio_busy() and page_busy() without @@ -4081,13 +4069,11 @@ void vfs_syncall(void) { if (rootdir == NULL && !modrootloaded) - return; /* panic during boot - no filesystems yet */ + return; /* no filesystems have been loaded yet */ printf("syncing file systems..."); - vfs_syncprogress(); sync(); - vfs_syncprogress(); sync_triesleft = sync_retries; old_bufcnt = new_bufcnt = INT_MAX; @@ -4099,7 +4085,6 @@ vfs_syncall(void) new_bufcnt = bio_busy(B_TRUE); new_pgcnt = page_busy(B_TRUE); - vfs_syncprogress(); if (new_bufcnt == 0 && new_pgcnt == 0) break; @@ -4122,27 +4107,9 @@ vfs_syncall(void) else printf(" done\n"); - sync_timeleft = 0; delay(hz); } -/* - * If we are in the middle of the sync phase of panic, reset sync_timeleft to - * sync_timeout to indicate that we are making progress and the deadman() - * omnipresent cyclic should not yet time us out. Note that it is safe to - * store to sync_timeleft here since the deadman() is firing at high-level - * on top of us. If we are racing with the deadman(), either the deadman() - * will decrement the old value and then we will reset it, or we will - * reset it and then the deadman() will immediately decrement it. In either - * case, correct behavior results. - */ -void -vfs_syncprogress(void) -{ - if (panicstr) - sync_timeleft = sync_timeout; -} - /* * Map VFS flags to statvfs flags. These shouldn't really be separate * flags at all. -- cgit v1.2.3