pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/58545: e2fsprogs-1.46.4nb2: error updating superblock on raw devices
>Number: 58545
>Category: pkg
>Synopsis: e2fsprogs-1.46.4nb2: error updating superblock on raw devices
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Aug 03 07:25:01 +0000 2024
>Originator: RVP
>Release: pkgsrc-2024Q2
>Organization:
>Environment:
NetBSD/amd64 10.99.11
>Description:
On NetBSD, if you run e2fsck on a raw (ie. char.) disk device, you get
this error:
```
$ ls -l /dev/rdk11
crw-r----- 1 root operator 168, 11 Apr 17 05:53 /dev/rdk11
$ sudo e2fsck -f /dev/rdk11
Password:
e2fsck 1.46.4 (18-Aug-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Error writing file system info: Invalid argument
/dev/rdk11: ***** FILE SYSTEM WAS MODIFIED *****
```
and the modified superblock is not written (try running the command
again and you'll get the same error) because e2fsck tries to write
only the modified bytes at non-block-size offsets and this is not
permitted on raw disk devices.
If you run e2fsck on the block device (/dev/dk11), then there are, of course, no such alignment/block-size write-restrictions and it succeeds.
Alas, however, you don't want to use these as any reads/writes to them
go through the buffer-cache, a) making the checks slow and b) evicting
the more useful stuff in them.
>How-To-Repeat:
e2fsck -f /dev/rdkNN
>Fix:
Teach e2fsprogs that raw devices on NetBSD behave the same as do char. devices on FreeBSD. e2fsprogs will then read/write full blocks.
```
diff -urN e2fsprogs-1.47.1.orig/lib/ext2fs/ext2fsP.h e2fsprogs-1.47.1/lib/ext2fs/ext2fsP.h
--- e2fsprogs-1.47.1.orig/lib/ext2fs/ext2fsP.h 2024-05-21 02:52:47.000000000 +0000
+++ e2fsprogs-1.47.1/lib/ext2fs/ext2fsP.h 2024-07-29 08:00:38.703197642 +0000
@@ -19,7 +19,7 @@
static inline int ext2fsP_is_disk_device(mode_t mode)
{
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
return S_ISBLK(mode) || S_ISCHR(mode);
#else
return S_ISBLK(mode);
diff -urN e2fsprogs-1.47.1.orig/lib/ext2fs/unix_io.c e2fsprogs-1.47.1/lib/ext2fs/unix_io.c
--- e2fsprogs-1.47.1.orig/lib/ext2fs/unix_io.c 2024-05-21 02:52:47.000000000 +0000
+++ e2fsprogs-1.47.1/lib/ext2fs/unix_io.c 2024-07-29 07:56:56.045970673 +0000
@@ -780,7 +780,7 @@
io->align = 512;
#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
if (io->flags & CHANNEL_FLAGS_BLOCK_DEVICE) {
int dio_align = ext2fs_get_dio_alignment(fd);
```
Note that
a) the patch is for the latest e2fsprogs version, and,
b) you'll need to pass `--without-libarchive' to configure to bypass
the lack of a uselocale(3) on NetBSD.
Home |
Main Index |
Thread Index |
Old Index