Thu Jul 31 15:37:56 2008 UTC ()
Ffs snapshots don't work (yet) with WAPBL:
- no snapshot creation on logging file systems.
- refuse to mount logging file systems with persistent snapshots.

Ok: Simon Burge <simonb@netbsd.org>


(hannken)
diff -r1.72 -r1.73 src/sys/ufs/ffs/ffs_snapshot.c
diff -r1.231 -r1.232 src/sys/ufs/ffs/ffs_vfsops.c

cvs diff -r1.72 -r1.73 src/sys/ufs/ffs/ffs_snapshot.c (expand / switch to unified diff)

--- src/sys/ufs/ffs/ffs_snapshot.c 2008/07/30 10:09:30 1.72
+++ src/sys/ufs/ffs/ffs_snapshot.c 2008/07/31 15:37:56 1.73
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ffs_snapshot.c,v 1.72 2008/07/30 10:09:30 hannken Exp $ */ 1/* $NetBSD: ffs_snapshot.c,v 1.73 2008/07/31 15:37:56 hannken Exp $ */
2 2
3/* 3/*
4 * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. 4 * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
5 * 5 *
6 * Further information about snapshots can be obtained from: 6 * Further information about snapshots can be obtained from:
7 * 7 *
8 * Marshall Kirk McKusick http://www.mckusick.com/softdep/ 8 * Marshall Kirk McKusick http://www.mckusick.com/softdep/
9 * 1614 Oxford Street mckusick@mckusick.com 9 * 1614 Oxford Street mckusick@mckusick.com
10 * Berkeley, CA 94709-1608 +1-510-843-9542 10 * Berkeley, CA 94709-1608 +1-510-843-9542
11 * USA 11 * USA
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions 14 * modification, are permitted provided that the following conditions
@@ -28,27 +28,27 @@ @@ -28,27 +28,27 @@
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE. 33 * SUCH DAMAGE.
34 * 34 *
35 * @(#)ffs_snapshot.c 8.11 (McKusick) 7/23/00 35 * @(#)ffs_snapshot.c 8.11 (McKusick) 7/23/00
36 * 36 *
37 * from FreeBSD: ffs_snapshot.c,v 1.79 2004/02/13 02:02:06 kuriyama Exp 37 * from FreeBSD: ffs_snapshot.c,v 1.79 2004/02/13 02:02:06 kuriyama Exp
38 */ 38 */
39 39
40#include <sys/cdefs.h> 40#include <sys/cdefs.h>
41__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.72 2008/07/30 10:09:30 hannken Exp $"); 41__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.73 2008/07/31 15:37:56 hannken Exp $");
42 42
43#if defined(_KERNEL_OPT) 43#if defined(_KERNEL_OPT)
44#include "opt_ffs.h" 44#include "opt_ffs.h"
45#endif 45#endif
46 46
47#include <sys/param.h> 47#include <sys/param.h>
48#include <sys/kernel.h> 48#include <sys/kernel.h>
49#include <sys/systm.h> 49#include <sys/systm.h>
50#include <sys/conf.h> 50#include <sys/conf.h>
51#include <sys/buf.h> 51#include <sys/buf.h>
52#include <sys/proc.h> 52#include <sys/proc.h>
53#include <sys/namei.h> 53#include <sys/namei.h>
54#include <sys/sched.h> 54#include <sys/sched.h>
@@ -197,26 +197,29 @@ ffs_snapshot(struct mount *mp, struct vn @@ -197,26 +197,29 @@ ffs_snapshot(struct mount *mp, struct vn
197 void *space; 197 void *space;
198 void *sbbuf = NULL; 198 void *sbbuf = NULL;
199 struct fs *copy_fs = NULL, *fs = VFSTOUFS(mp)->um_fs; 199 struct fs *copy_fs = NULL, *fs = VFSTOUFS(mp)->um_fs;
200 struct lwp *l = curlwp; 200 struct lwp *l = curlwp;
201 struct inode *ip, *xp; 201 struct inode *ip, *xp;
202 struct buf *bp, *ibp, *nbp; 202 struct buf *bp, *ibp, *nbp;
203 struct vattr vat; 203 struct vattr vat;
204 struct vnode *xvp, *mvp, *devvp; 204 struct vnode *xvp, *mvp, *devvp;
205 struct snap_info *si; 205 struct snap_info *si;
206 206
207 ns = UFS_FSNEEDSWAP(fs); 207 ns = UFS_FSNEEDSWAP(fs);
208 si = VFSTOUFS(mp)->um_snapinfo; 208 si = VFSTOUFS(mp)->um_snapinfo;
209 209
 210 /* Snapshots do not work yet with WAPBL. */
 211 if ((mp->mnt_flag & MNT_LOG))
 212 return EOPNOTSUPP;
210 /* 213 /*
211 * Need to serialize access to snapshot code per filesystem. 214 * Need to serialize access to snapshot code per filesystem.
212 */ 215 */
213 /* 216 /*
214 * If the vnode already is a snapshot, return. 217 * If the vnode already is a snapshot, return.
215 */ 218 */
216 if (VTOI(vp)->i_flags & SF_SNAPSHOT) { 219 if (VTOI(vp)->i_flags & SF_SNAPSHOT) {
217 if (ctime) { 220 if (ctime) {
218 ctime->tv_sec = DIP(VTOI(vp), mtime); 221 ctime->tv_sec = DIP(VTOI(vp), mtime);
219 ctime->tv_nsec = DIP(VTOI(vp), mtimensec); 222 ctime->tv_nsec = DIP(VTOI(vp), mtimensec);
220 } 223 }
221 return 0; 224 return 0;
222 } 225 }

cvs diff -r1.231 -r1.232 src/sys/ufs/ffs/ffs_vfsops.c (expand / switch to unified diff)

--- src/sys/ufs/ffs/ffs_vfsops.c 2008/07/31 05:38:06 1.231
+++ src/sys/ufs/ffs/ffs_vfsops.c 2008/07/31 15:37:56 1.232
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ffs_vfsops.c,v 1.231 2008/07/31 05:38:06 simonb Exp $ */ 1/* $NetBSD: ffs_vfsops.c,v 1.232 2008/07/31 15:37:56 hannken Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Wasabi Systems, Inc. 8 * by Wasabi Systems, Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -51,27 +51,27 @@ @@ -51,27 +51,27 @@
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE. 58 * SUCH DAMAGE.
59 * 59 *
60 * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 60 * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95
61 */ 61 */
62 62
63#include <sys/cdefs.h> 63#include <sys/cdefs.h>
64__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.231 2008/07/31 05:38:06 simonb Exp $"); 64__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.232 2008/07/31 15:37:56 hannken Exp $");
65 65
66#if defined(_KERNEL_OPT) 66#if defined(_KERNEL_OPT)
67#include "opt_ffs.h" 67#include "opt_ffs.h"
68#include "opt_quota.h" 68#include "opt_quota.h"
69#include "opt_softdep.h" 69#include "opt_softdep.h"
70#include "opt_wapbl.h" 70#include "opt_wapbl.h"
71#endif 71#endif
72 72
73#include <sys/param.h> 73#include <sys/param.h>
74#include <sys/systm.h> 74#include <sys/systm.h>
75#include <sys/namei.h> 75#include <sys/namei.h>
76#include <sys/proc.h> 76#include <sys/proc.h>
77#include <sys/kernel.h> 77#include <sys/kernel.h>
@@ -1281,46 +1281,53 @@ ffs_mountfs(struct vnode *devvp, struct  @@ -1281,46 +1281,53 @@ ffs_mountfs(struct vnode *devvp, struct
1281 ump->um_lognindir = ffs(fs->fs_nindir) - 1; 1281 ump->um_lognindir = ffs(fs->fs_nindir) - 1;
1282 ump->um_bptrtodb = fs->fs_fsbtodb; 1282 ump->um_bptrtodb = fs->fs_fsbtodb;
1283 ump->um_seqinc = fs->fs_frag; 1283 ump->um_seqinc = fs->fs_frag;
1284 for (i = 0; i < MAXQUOTAS; i++) 1284 for (i = 0; i < MAXQUOTAS; i++)
1285 ump->um_quotas[i] = NULLVP; 1285 ump->um_quotas[i] = NULLVP;
1286 devvp->v_specmountpoint = mp; 1286 devvp->v_specmountpoint = mp;
1287 if (ronly == 0 && (fs->fs_flags & FS_DOSOFTDEP)) { 1287 if (ronly == 0 && (fs->fs_flags & FS_DOSOFTDEP)) {
1288 error = softdep_mount(devvp, mp, fs, cred); 1288 error = softdep_mount(devvp, mp, fs, cred);
1289 if (error) { 1289 if (error) {
1290 free(fs->fs_csp, M_UFSMNT); 1290 free(fs->fs_csp, M_UFSMNT);
1291 goto out; 1291 goto out;
1292 } 1292 }
1293 } 1293 }
 1294 /* Snapshots do not work yet with WAPBL. */
 1295 if (ronly == 0 && fs->fs_snapinum[0] != 0 && (mp->mnt_flag & MNT_LOG)) {
 1296 printf("%s fs has snapshots -- logging not supported yet\n",
 1297 fs->fs_fsmnt);
 1298 error = EINVAL;
 1299 free(fs->fs_csp, M_UFSMNT);
 1300 goto out;
 1301 }
 1302 if (ronly == 0 && fs->fs_snapinum[0] != 0)
 1303 ffs_snapshot_mount(mp);
1294 1304
1295#ifdef WAPBL 1305#ifdef WAPBL
1296 if (!ronly) { 1306 if (!ronly) {
1297 KDASSERT(fs->fs_ronly == 0); 1307 KDASSERT(fs->fs_ronly == 0);
1298 /* 1308 /*
1299 * ffs_wapbl_start() needs mp->mnt_stat initialised if it 1309 * ffs_wapbl_start() needs mp->mnt_stat initialised if it
1300 * needs to create a new log file in-filesystem. 1310 * needs to create a new log file in-filesystem.
1301 */ 1311 */
1302 ffs_statvfs(mp, &mp->mnt_stat); 1312 ffs_statvfs(mp, &mp->mnt_stat);
1303 1313
1304 error = ffs_wapbl_start(mp); 1314 error = ffs_wapbl_start(mp);
1305 if (error) { 1315 if (error) {
1306 free(fs->fs_csp, M_UFSMNT); 1316 free(fs->fs_csp, M_UFSMNT);
1307 goto out; 1317 goto out;
1308 } 1318 }
1309 } 1319 }
1310#endif /* WAPBL */ 1320#endif /* WAPBL */
1311 
1312 if (ronly == 0 && fs->fs_snapinum[0] != 0) 
1313 ffs_snapshot_mount(mp); 
1314#ifdef UFS_EXTATTR 1321#ifdef UFS_EXTATTR
1315 /* 1322 /*
1316 * Initialize file-backed extended attributes on UFS1 file 1323 * Initialize file-backed extended attributes on UFS1 file
1317 * systems. 1324 * systems.
1318 */ 1325 */
1319 if (ump->um_fstype == UFS1) { 1326 if (ump->um_fstype == UFS1) {
1320 ufs_extattr_uepm_init(&ump->um_extattr); 1327 ufs_extattr_uepm_init(&ump->um_extattr);
1321#ifdef UFS_EXTATTR_AUTOSTART 1328#ifdef UFS_EXTATTR_AUTOSTART
1322 /* 1329 /*
1323 * XXX Just ignore errors. Not clear that we should 1330 * XXX Just ignore errors. Not clear that we should
1324 * XXX fail the mount in this case. 1331 * XXX fail the mount in this case.
1325 */ 1332 */
1326 (void) ufs_extattr_autostart(mp, l); 1333 (void) ufs_extattr_autostart(mp, l);