Project

General

Profile

Actions

Bug #1570

closed

HAMMER: you can newfs a mounted hammer device

Added by lentferj about 15 years ago. Updated about 15 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Retry the following:

  1. newfs_hammer -L pgsql /dev/ad7s2d
  2. mount_hammer /dev/ad7s2d /usr/pkg/pgsq
  3. newfs /dev/ad7s2d
  4. umount /usr/pkg/pgsql
  5. mount /dev/ad7s2d /usr/pkg/pgsql
  6. mount | grep pgsql
    dev/ad7s2d on /usr/pkg/pgsql (ufs, local)

So, it actually newfs'd the mounted hammer fs, then you can unmount
the hammer and mount the device as UFS.

I think it works because newfs looks into the mounted devices, but
there is no /dev/xyz, but only the label... so it goes on happily and
newfs maybe does not check for existing superblocks (like newfs.xfs)
and if it checks maybe it doesn't know how a hammer one looks like.

Kind Regards,

Jan Lentfer

Actions #3

Updated by tuxillo about 15 years ago

Previous submits are wrong, please don't commit. Sorry for the noise

Actions #5

Updated by tuxillo about 15 years ago

Finally I did last changes by request:
http://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff/87b0928085ae33591193b69255bd35cc46e5a5ed

I've tested it and it seems to work:

Writing to R/O is permitted.
-------------------------------------------------
vmware# mount -o ro /dev/da0s1d /mnt/test/
vmware# ./testwrite da0s1d
Opened /dev/da0s1d for writing: fd 3

Writing to R/W not allowed
-------------------------------------
vmware# umount /mnt/test/
vmware# mount -o rw /dev/da0s1d /mnt/test/
vmware# ./testwrite ad0s1a
/dev/ad0s1a opening failed
open: Device busy

When securelevel set >= 1, no writing allowed
-------------------------------------------------
vmware# umount /mnt/test/
vmware# mount -o ro /dev/da0s1d /mnt/test/
vmware# sysctl kern.securelevel=1
kern.securelevel: -1 -> 1
vmware# ./testwrite da0s1d
/dev/da0s1d opening failed
open: Operation not permitted

Actions #6

Updated by tuxillo about 15 years ago

Fix committed in ddd7de8218ab45cb082d928d8573a7ca48b3c131

Actions

Also available in: Atom PDF