NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/54969: Disk cache is no longer flushed on shutdown



The following reply was made to PR kern/54969; it has been noted by GNATS.

From: "J. Hannken-Illjes" <hannken%eis.cs.tu-bs.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: Andreas Gustafsson <gson%gson.org@localhost>
Subject: Re: kern/54969: Disk cache is no longer flushed on shutdown
Date: Thu, 20 Feb 2020 09:50:48 +0100

 --Apple-Mail=_E794A460-544A-495A-93E2-ABF6592D6DBE
 Content-Type: multipart/mixed;
 	boundary="Apple-Mail=_97B3B872-94A5-4D88-995F-1564B709CEC8"
 
 
 --Apple-Mail=_97B3B872-94A5-4D88-995F-1564B709CEC8
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii
 
 > On 19. Feb 2020, at 15:40, Andreas Gustafsson <gson%gson.org@localhost> wrote:
 <snip>
 > Also, I said "halt -p" in the PR, but
 > checking the logs, I see that the actual command used was a plain
 > "halt" without the -p option.
 
 Sorry, I missed that.
 
 The attached diff restores the previous behaviour and destroys
 all device vnodes once the mountlist is empty.
 
 --
 J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig
 
 
 --Apple-Mail=_97B3B872-94A5-4D88-995F-1564B709CEC8
 Content-Disposition: attachment;
 	filename=vfs_mount.c.diff
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="vfs_mount.c.diff"
 Content-Transfer-Encoding: 7bit
 
 diff -r 9cba3dc7e065 sys/kern/vfs_mount.c
 --- sys/kern/vfs_mount.c	Wed Feb 19 09:01:50 2020 +0100
 +++ sys/kern/vfs_mount.c	Thu Feb 20 09:47:23 2020 +0100
 @@ -114,6 +114,8 @@ static struct vnode *vfs_vnode_iterator_
  /* Root filesystem. */
  vnode_t *			rootvnode;
  
 +extern struct mount		*dead_rootmount;
 +
  /* Mounted filesystem list. */
  static TAILQ_HEAD(mountlist, mountlist_entry) mountlist;
  static kmutex_t			mountlist_lock __cacheline_aligned;
 @@ -1014,6 +1016,7 @@ bool
  vfs_unmountall1(struct lwp *l, bool force, bool verbose)
  {
  	struct mount *mp;
 +	mount_iterator_t *iter;
  	bool any_error = false, progress = false;
  	uint64_t gen;
  	int error;
 @@ -1048,6 +1051,24 @@ vfs_unmountall1(struct lwp *l, bool forc
  	if (any_error && verbose) {
  		printf("WARNING: some file systems would not unmount\n");
  	}
 +
 +	/* If the mountlist is empty destroy anonymous device vnodes. */
 +	mountlist_iterator_init(&iter);
 +	if (mountlist_iterator_next(iter) == NULL) {
 +		struct vnode_iterator *marker;
 +		vnode_t *vp;
 +
 +		vfs_vnode_iterator_init(dead_rootmount, &marker);
 +		while ((vp = vfs_vnode_iterator_next(marker, NULL, NULL))) {
 +			if (vp->v_type == VCHR || vp->v_type == VBLK)
 +				vgone(vp);
 +			else
 +				vrele(vp);
 +		}
 +		vfs_vnode_iterator_destroy(marker);
 +	}
 +	mountlist_iterator_destroy(iter);
 +
  	return progress;
  }
  
 
 --Apple-Mail=_97B3B872-94A5-4D88-995F-1564B709CEC8--
 
 --Apple-Mail=_E794A460-544A-495A-93E2-ABF6592D6DBE
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP
 
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAEBCAAdFiEE2BL3ha7Xao4WUZVYKoaVJdNr+uEFAl5OSGgACgkQKoaVJdNr
 +uGSGQf/XouOoWRpynjY3tFz5SSjLEUTYBygYPtwk+b7FSK1u0mF1PENgrZvVMCu
 PNX48MslL1MycU/HlsEwHUM4Zdw+dvqvQjJSW+wfCe3ILu+jHciIm+7KrCOfVEit
 Z53zJs9EYuxzjSO+PCfFkQFXeR1mWcCbnoupKZXdWz4Bp8fZcCclUVJ2AKmcBksE
 +bJNJUSM6CwEdhltLDq/3dRUVejimWMfs0NGgtc16KXMmiMBn0+Ma3dyrea2zrl5
 7lhAhByqjMIINK+ZoXKlkMZg+vnl8Jh/nM1KuitccpyZOz8UiGKxd0HaMiedF95z
 RjIfqXIhx9li6S0QvSgfMqRN5hheGA==
 =31gT
 -----END PGP SIGNATURE-----
 
 --Apple-Mail=_E794A460-544A-495A-93E2-ABF6592D6DBE--
 


Home | Main Index | Thread Index | Old Index