Source-Changes-HG archive

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

[src/trunk]: src Restore backward compatibility of UFS2 with previous NetBSD ...



details:   https://anonhg.NetBSD.org/src/rev/2fdb51757c5e
branches:  trunk
changeset: 372341:2fdb51757c5e
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Nov 17 06:40:38 2022 +0000

description:
Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).

diffstat:

 UPDATING                                   |   29 ++-
 distrib/sets/lists/tests/mi                |    3 +-
 sbin/badsect/badsect.c                     |    6 +-
 sbin/cgdconfig/cgdconfig.c                 |    6 +-
 sbin/clri/clri.c                           |    6 +-
 sbin/dump/ffs_inode.c                      |   10 +-
 sbin/fsck_ffs/extern.h                     |    3 +-
 sbin/fsck_ffs/fsck.h                       |    6 +-
 sbin/fsck_ffs/fsck_ffs.8                   |   21 +-
 sbin/fsck_ffs/main.c                       |   17 +-
 sbin/fsck_ffs/pass1.c                      |   22 +-
 sbin/fsck_ffs/pass5.c                      |   17 +-
 sbin/fsck_ffs/setup.c                      |   48 +++-
 sbin/fsck_ffs/utilities.c                  |   16 +-
 sbin/fsdb/fsdb.8                           |   10 +-
 sbin/fsdb/fsdb.c                           |  335 +++++++++++++++++++++++++++-
 sbin/fsdb/fsdbutil.c                       |   10 +-
 sbin/fsirand/fsirand.c                     |    6 +-
 sbin/newfs/extern.h                        |    3 +-
 sbin/newfs/mkfs.c                          |    6 +-
 sbin/newfs/newfs.8                         |    5 +-
 sbin/newfs/newfs.c                         |   11 +-
 sbin/resize_ffs/resize_ffs.c               |    6 +-
 sbin/scan_ffs/scan_ffs.c                   |    6 +-
 sbin/tunefs/tunefs.c                       |   19 +-
 sys/arch/hppa/stand/xxboot/readufs_ffs.c   |    7 +-
 sys/arch/sparc/stand/bootblk/bootblk.fth   |    5 +-
 sys/arch/sparc/stand/bootblk/genfth.cf     |    3 +-
 sys/arch/x68k/stand/boot_ufs/readufs_ffs.c |    7 +-
 sys/lib/libsa/ffsv1.c                      |    7 +-
 sys/lib/libsa/ffsv2.c                      |    7 +-
 sys/lib/libsa/lfsv1.c                      |    4 +-
 sys/lib/libsa/lfsv2.c                      |    4 +-
 sys/lib/libsa/ufs.c                        |   46 +++-
 sys/ufs/ffs/ffs_balloc.c                   |    6 +-
 sys/ufs/ffs/ffs_extattr.c                  |    8 +-
 sys/ufs/ffs/ffs_vfsops.c                   |   25 +-
 sys/ufs/ffs/fs.h                           |    4 +-
 sys/ufs/ufs/ufs_bmap.c                     |    6 +-
 sys/ufs/ufs/ufsmount.h                     |    3 +-
 tests/fs/ffs/t_extattr.c                   |    8 +-
 tests/sbin/fsck_ffs/Makefile               |    4 +-
 tests/sbin/fsck_ffs/t_extattr.sh           |  197 +++++++++++++++++
 usr.sbin/dumpfs/dumpfs.c                   |    9 +-
 usr.sbin/fstyp/ufs.c                       |   10 +-
 usr.sbin/installboot/ffs.c                 |    6 +-
 usr.sbin/makefs/ffs.c                      |    7 +-
 usr.sbin/makefs/ffs.h                      |    3 +-
 usr.sbin/makefs/ffs/ffs_balloc.c           |    7 +-
 usr.sbin/makefs/ffs/mkfs.c                 |   11 +-
 usr.sbin/makefs/makefs.8                   |    4 +-
 usr.sbin/quot/quot.c                       |    8 +-
 usr.sbin/quotacheck/quotacheck.c           |   10 +-
 usr.sbin/sysinst/label.c                   |    6 +-
 54 files changed, 908 insertions(+), 151 deletions(-)

diffs (truncated from 2526 to 300 lines):

diff -r 6fc7abb445db -r 2fdb51757c5e UPDATING
--- a/UPDATING  Thu Nov 17 05:02:11 2022 +0000
+++ b/UPDATING  Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.334 2022/11/12 02:20:15 mrg Exp $
+$NetBSD: UPDATING,v 1.335 2022/11/17 06:40:38 chs Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,33 @@
 Recent changes:
 ^^^^^^^^^^^^^^^
 
+20221116:
+
+       The addition to NetBSD's version of UFS2 of support for extended
+       attributes broke backward compatibility with previous releases
+       of NetBSD, so UFS2 has been restored to being compatible with
+       previous NetBSD releases by disabling extended attributes.
+       (Note that ACLs are implemented as extended attributes, so
+       this changes disables ACLs as well.)
+
+       Support for UFS2 with extended attributes is now available in a new
+       UFS variant called UFS2ea.  If you have created extended attributes
+       in an original UFS2 file system then "fsck -p" will now fail due to
+       the unexpected presence of extended attributes and "fsck -y" will
+       remove all extended attributes.  If you wish to preserve extended
+       attributes rather than delete them, there is a utility to convert
+       a UFS2 file system to UFS2ea and leave extended attributes in place,
+       but this should be used with caution since it will preserve any
+       extended attributes that have been corrupted by the backward
+       incompatibility too.
+
+       If you wish to use a UFS2ea file system as your root file system,
+       then you will need to update your boot loader to a version that
+       supports UFS2ea.
+
+       For more information, see:
+       https://wiki.netbsd.org/features/UFS2ea
+
 20221111:
        The new libdrm import worsened the conflict issues for the
        kdump/ktruss ioctl, and i915 now conflicts with base, and has
diff -r 6fc7abb445db -r 2fdb51757c5e distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Thu Nov 17 05:02:11 2022 +0000
+++ b/distrib/sets/lists/tests/mi       Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1230 2022/11/10 06:13:58 blymn Exp $
+# $NetBSD: mi,v 1.1231 2022/11/17 06:40:38 chs Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4354,6 +4354,7 @@
 ./usr/tests/sbin/fsck_ffs/Kyuafile                     tests-sbin-tests        compattestfile,atf,kyua
 ./usr/tests/sbin/fsck_ffs/t_check_quotas               tests-sbin-tests        compattestfile,atf
 ./usr/tests/sbin/fsck_ffs/t_enable_quotas              tests-sbin-tests        compattestfile,atf
+./usr/tests/sbin/fsck_ffs/t_extattr                    tests-sbin-tests        compattestfile,atf
 ./usr/tests/sbin/gpt                                   tests-sbin-tests        compattestfile,atf
 ./usr/tests/sbin/gpt/Atffile                           tests-sbin-tests        compattestfile,atf
 ./usr/tests/sbin/gpt/Kyuafile                          tests-sbin-tests        compattestfile,atf,kyua
diff -r 6fc7abb445db -r 2fdb51757c5e sbin/badsect/badsect.c
--- a/sbin/badsect/badsect.c    Thu Nov 17 05:02:11 2022 +0000
+++ b/sbin/badsect/badsect.c    Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: badsect.c,v 1.34 2016/09/05 01:09:57 sevan Exp $       */
+/*     $NetBSD: badsect.c,v 1.35 2022/11/17 06:40:38 chs Exp $ */
 
 /*
  * Copyright (c) 1981, 1983, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)badsect.c  8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: badsect.c,v 1.34 2016/09/05 01:09:57 sevan Exp $");
+__RCSID("$NetBSD: badsect.c,v 1.35 2022/11/17 06:40:38 chs Exp $");
 #endif
 #endif /* not lint */
 
@@ -151,11 +151,13 @@
                rdfs(sblock_try[i], SBLOCKSIZE, fs);
                switch (fs->fs_magic) {
                case FS_UFS2_MAGIC:
+               case FS_UFS2EA_MAGIC:
                        is_ufs2 = 1;
                        /* FALLTHROUGH */
                case FS_UFS1_MAGIC:
                        break;
                case FS_UFS2_MAGIC_SWAPPED:
+               case FS_UFS2EA_MAGIC_SWAPPED:
                        is_ufs2 = 1;
                        /* FALLTHROUGH */
                case FS_UFS1_MAGIC_SWAPPED:
diff -r 6fc7abb445db -r 2fdb51757c5e sbin/cgdconfig/cgdconfig.c
--- a/sbin/cgdconfig/cgdconfig.c        Thu Nov 17 05:02:11 2022 +0000
+++ b/sbin/cgdconfig/cgdconfig.c        Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgdconfig.c,v 1.60 2022/09/13 10:14:32 riastradh Exp $ */
+/* $NetBSD: cgdconfig.c,v 1.61 2022/11/17 06:40:38 chs Exp $ */
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2002, 2003\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: cgdconfig.c,v 1.60 2022/09/13 10:14:32 riastradh Exp $");
+__RCSID("$NetBSD: cgdconfig.c,v 1.61 2022/11/17 06:40:38 chs Exp $");
 #endif
 
 #ifdef HAVE_ARGON2
@@ -1207,8 +1207,10 @@
                switch (u.fs.fs_magic) {
                case FS_UFS1_MAGIC:
                case FS_UFS2_MAGIC:
+               case FS_UFS2EA_MAGIC:
                case FS_UFS1_MAGIC_SWAPPED:
                case FS_UFS2_MAGIC_SWAPPED:
+               case FS_UFS2EA_MAGIC_SWAPPED:
                        return 0;
                default:
                        continue;
diff -r 6fc7abb445db -r 2fdb51757c5e sbin/clri/clri.c
--- a/sbin/clri/clri.c  Thu Nov 17 05:02:11 2022 +0000
+++ b/sbin/clri/clri.c  Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clri.c,v 1.24 2015/08/30 05:23:17 mlelstv Exp $        */
+/*     $NetBSD: clri.c,v 1.25 2022/11/17 06:40:38 chs Exp $    */
 
 /*
  * Copyright (c) 1990, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)clri.c     8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: clri.c,v 1.24 2015/08/30 05:23:17 mlelstv Exp $");
+__RCSID("$NetBSD: clri.c,v 1.25 2022/11/17 06:40:38 chs Exp $");
 #endif
 #endif /* not lint */
 
@@ -107,11 +107,13 @@
                sbp = (struct fs *)sblock;
                switch(sbp->fs_magic) {
                case FS_UFS2_MAGIC:
+               case FS_UFS2EA_MAGIC:
                        is_ufs2 = 1;
                        /*FALLTHROUGH*/
                case FS_UFS1_MAGIC:
                        break;
                case FS_UFS2_MAGIC_SWAPPED:
+               case FS_UFS2EA_MAGIC_SWAPPED:
                        is_ufs2 = 1;
                        /*FALLTHROUGH*/
                case FS_UFS1_MAGIC_SWAPPED:
diff -r 6fc7abb445db -r 2fdb51757c5e sbin/dump/ffs_inode.c
--- a/sbin/dump/ffs_inode.c     Thu Nov 17 05:02:11 2022 +0000
+++ b/sbin/dump/ffs_inode.c     Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_inode.c,v 1.23 2019/03/01 16:42:11 christos Exp $ */
+/*     $NetBSD: ffs_inode.c,v 1.24 2022/11/17 06:40:38 chs Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -36,7 +36,7 @@
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: ffs_inode.c,v 1.23 2019/03/01 16:42:11 christos Exp $");
+__RCSID("$NetBSD: ffs_inode.c,v 1.24 2022/11/17 06:40:38 chs Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -83,11 +83,17 @@
                rawread(sblock_try[i], (char *)superblock, MAXBSIZE);
 
                switch(sblock->fs_magic) {
+               case FS_UFS2EA_MAGIC:
+                       sblock->fs_magic = FS_UFS2_MAGIC;
+                       /*FALLTHROUGH*/
                case FS_UFS2_MAGIC:
                        is_ufs2 = 1;
                        /*FALLTHROUGH*/
                case FS_UFS1_MAGIC:
                        break;
+               case FS_UFS2EA_MAGIC_SWAPPED:
+                       sblock->fs_magic = FS_UFS2_MAGIC_SWAPPED;
+                       /*FALLTHROUGH*/
                case FS_UFS2_MAGIC_SWAPPED:
                        is_ufs2 = 1;
                        /*FALLTHROUGH*/
diff -r 6fc7abb445db -r 2fdb51757c5e sbin/fsck_ffs/extern.h
--- a/sbin/fsck_ffs/extern.h    Thu Nov 17 05:02:11 2022 +0000
+++ b/sbin/fsck_ffs/extern.h    Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.27 2011/06/09 19:57:52 christos Exp $     */
+/*     $NetBSD: extern.h,v 1.28 2022/11/17 06:40:38 chs Exp $  */
 
 /*
  * Copyright (c) 1994 James A. Jegers
@@ -42,6 +42,7 @@
 int            cmpsblks(const struct fs *, struct fs *);
 int            cmpsblks42(const struct fs *, struct fs *);
 int            cmpsblks44(const struct fs *, struct fs *);
+void           cvt_magic(struct fs *);
 union          dinode * getnextinode(ino_t);
 void           direrror(ino_t, const char *);
 int            dirscan(struct inodesc *);
diff -r 6fc7abb445db -r 2fdb51757c5e sbin/fsck_ffs/fsck.h
--- a/sbin/fsck_ffs/fsck.h      Thu Nov 17 05:02:11 2022 +0000
+++ b/sbin/fsck_ffs/fsck.h      Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fsck.h,v 1.55 2020/04/18 12:54:38 jdolecek Exp $       */
+/*     $NetBSD: fsck.h,v 1.56 2022/11/17 06:40:38 chs Exp $    */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -166,6 +166,7 @@
                sb_oldfscompat_write(sblk.b_un.b_fs, sblocksave); \
                if (needswap) \
                        ffs_sb_swap(sblk.b_un.b_fs, sblk.b_un.b_fs); \
+               cvt_magic(sblk.b_un.b_fs); \
                sblk.b_dirty = 1; \
        } while (0)
 #define        cgdirty()       do {copyback_cg(&cgblk); cgblk.b_dirty = 1;} while (0)
@@ -280,12 +281,15 @@
 extern int     cvtlevel;       /* convert to newer file system format */
 extern int     doinglevel1;    /* converting to new cylinder group format */
 extern int     doinglevel2;    /* converting to new inode format */
+extern int     doing2ea;       /* converting UFS2 to UFS2ea */
+extern int     doing2noea;     /* converting UFS2ea to UFS2 */
 extern int     newinofmt;      /* filesystem has new inode format */
 extern char    usedsoftdep;    /* just fix soft dependency inconsistencies */
 extern int     preen;          /* just fix normal inconsistencies */
 extern int     quiet;          /* Don't print anything if clean */
 extern int     forceimage;     /* file system is an image file */
 extern int     is_ufs2;        /* we're dealing with an UFS2 filesystem */
+extern int     is_ufs2ea;      /* is the variant that supports exattrs */
 extern int     markclean;      /* mark file system clean when done */
 extern char    havesb;         /* superblock has been read */
 extern char    skipclean;      /* skip clean file systems if preening */
diff -r 6fc7abb445db -r 2fdb51757c5e sbin/fsck_ffs/fsck_ffs.8
--- a/sbin/fsck_ffs/fsck_ffs.8  Thu Nov 17 05:02:11 2022 +0000
+++ b/sbin/fsck_ffs/fsck_ffs.8  Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: fsck_ffs.8,v 1.51 2019/05/05 14:59:06 christos Exp $
+.\"    $NetBSD: fsck_ffs.8,v 1.52 2022/11/17 06:40:38 chs Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -205,7 +205,23 @@
 .Xr newfs 8 .
 .El
 .Pp
-Note that FFSv2 file systems are always level 4.
+Note that FFSv2 file systems always have the features of FFSv1 level 4.
+.Pp
+FFSv2 file systems have separate conversion options:
+.Bl -tag -width 3n -offset indent
+.It ea
+Convert the file system to the format which supports extended attributes
+(and access control lists).
+After this conversion is performed, the file system will no longer be
+recognized at all by releases prior to
+.Nx 10.0 .
+.It no-ea
+Convert the file system to the format which does not support extended attributes
+(or access control lists).
+This will remove any existing extended attributes, and the file system
+will become recognizable to releases prior to
+.Nx 10.0 .
+.El
 .Pp
 In interactive mode,
 .Nm
@@ -227,6 +243,7 @@
 and the file system level
 .Dq ( fslevel
 in the sixth line).
+.Pp
 .It Fl d
 Print debugging output.
 .It Fl F
diff -r 6fc7abb445db -r 2fdb51757c5e sbin/fsck_ffs/main.c
--- a/sbin/fsck_ffs/main.c      Thu Nov 17 05:02:11 2022 +0000
+++ b/sbin/fsck_ffs/main.c      Thu Nov 17 06:40:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.89 2020/04/06 09:54:24 martin Exp $ */
+/*     $NetBSD: main.c,v 1.90 2022/11/17 06:40:38 chs Exp $    */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 5/14/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.89 2020/04/06 09:54:24 martin Exp $");
+__RCSID("$NetBSD: main.c,v 1.90 2022/11/17 06:40:38 chs Exp $");
 #endif
 #endif /* not lint */
 
@@ -102,11 +102,14 @@



Home | Main Index | Thread Index | Old Index