When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots) Approved by: Manuel Bouyer <bouyer@netbsd.org>
This commit is contained in:
parent
5704a46a71
commit
fcd5ec4841
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dump.h,v 1.43 2006/06/24 05:28:54 perseant Exp $ */
|
||||
/* $NetBSD: dump.h,v 1.44 2006/10/26 20:02:30 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -98,6 +98,7 @@ char *dumpinomap; /* map of files to be dumped */
|
|||
* All calculations done in 0.1" units!
|
||||
*/
|
||||
char *disk; /* name of the disk file */
|
||||
char *disk_dev; /* name of the raw device we are dumping */
|
||||
const char *tape; /* name of the tape file */
|
||||
const char *dumpdates; /* name of the file containing dump date information*/
|
||||
const char *temp; /* name of the file for doing rewrite of dumpdates */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.62 2006/06/24 05:28:54 perseant Exp $ */
|
||||
/* $NetBSD: main.c,v 1.63 2006/10/26 20:02:30 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993, 1994
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.62 2006/06/24 05:28:54 perseant Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.63 2006/10/26 20:02:30 hannken Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -272,6 +272,7 @@ main(int argc, char *argv[])
|
|||
*/
|
||||
getfstab(); /* /etc/fstab snarfed */
|
||||
disk = NULL;
|
||||
disk_dev = NULL;
|
||||
mountpoint = NULL;
|
||||
dirc = 0;
|
||||
for (i = 0; i < argc; i++) {
|
||||
|
@ -441,9 +442,11 @@ main(int argc, char *argv[])
|
|||
msg("Cannot open %s\n", disk);
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
disk_dev = disk;
|
||||
#else /* ! DUMP_LFS */
|
||||
if (snap_backup != NULL || snap_internal) {
|
||||
diskfd = snap_open(mntinfo->f_mntonname, snap_backup, &tnow);
|
||||
diskfd = snap_open(mntinfo->f_mntonname, snap_backup,
|
||||
&tnow, &disk_dev);
|
||||
if (diskfd < 0) {
|
||||
msg("Cannot open snapshot of %s\n",
|
||||
mntinfo->f_mntonname);
|
||||
|
@ -455,6 +458,7 @@ main(int argc, char *argv[])
|
|||
msg("Cannot open %s\n", disk);
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
disk_dev = disk;
|
||||
}
|
||||
sync();
|
||||
#endif /* ! DUMP_LFS */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: snapshot.c,v 1.2 2005/04/19 08:10:43 hannken Exp $ */
|
||||
/* $NetBSD: snapshot.c,v 1.3 2006/10/26 20:02:30 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -47,6 +47,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "snapshot.h"
|
||||
|
@ -56,10 +57,11 @@
|
|||
* using the second argument as backing store and return an open file
|
||||
* descriptor for the snapshot. If the second argument is NULL, use the first
|
||||
* as backing store. If the third argument is not NULL, it gets the time the
|
||||
* snapshot was created.
|
||||
* snapshot was created. If the fourth argument is not NULL, it gets the
|
||||
* snapshot device path.
|
||||
*/
|
||||
int
|
||||
snap_open(char *mountpoint, char *backup, time_t *snap_date)
|
||||
snap_open(char *mountpoint, char *backup, time_t *snap_date, char **snap_dev)
|
||||
{
|
||||
int i, fd, israw, fsinternal, dounlink, flags;
|
||||
char path[MAXPATHLEN], fss_dev[14];
|
||||
|
@ -142,6 +144,14 @@ snap_open(char *mountpoint, char *backup, time_t *snap_date)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (snap_dev != NULL) {
|
||||
*snap_dev = strdup(fss_dev);
|
||||
if (*snap_dev == NULL) {
|
||||
ioctl(fd, FSSIOCCLR);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
flags |= FSS_UNCONFIG_ON_CLOSE;
|
||||
if (ioctl(fd, FSSIOCGET, &fsg) < 0 ||
|
||||
ioctl(fd, FSSIOFSET, &flags) < 0 ||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: snapshot.h,v 1.2 2005/04/19 08:10:43 hannken Exp $ */
|
||||
/* $NetBSD: snapshot.h,v 1.3 2006/10/26 20:02:30 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -41,6 +41,7 @@
|
|||
* using the second argument as backing store and return an open file
|
||||
* descriptor for the snapshot. If the second argument is NULL, use the first
|
||||
* as backing store. If the third argument is not NULL, it gets the time the
|
||||
* snapshot was created.
|
||||
* snapshot was created. If the fourth argument is not NULL, it gets the
|
||||
* snapshot device path.
|
||||
*/
|
||||
int snap_open(char *, char *, time_t *);
|
||||
int snap_open(char *, char *, time_t *, char **);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tape.c,v 1.46 2006/06/24 05:28:54 perseant Exp $ */
|
||||
/* $NetBSD: tape.c,v 1.47 2006/10/26 20:02:30 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tape.c 8.4 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: tape.c,v 1.46 2006/06/24 05:28:54 perseant Exp $");
|
||||
__RCSID("$NetBSD: tape.c,v 1.47 2006/10/26 20:02:30 hannken Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -823,7 +823,7 @@ doslave(int cmd, int slave_number)
|
|||
* Need our own seek pointer.
|
||||
*/
|
||||
(void) close(diskfd);
|
||||
if ((diskfd = open(disk, O_RDONLY)) < 0)
|
||||
if ((diskfd = open(disk_dev, O_RDONLY)) < 0)
|
||||
quit("slave couldn't reopen disk: %s\n", strerror(errno));
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue