HEADS UP: SUJ Going in to head today

Andriy Gapon avg at icyb.net.ua
Tue Apr 27 11:34:45 UTC 2010


on 27/04/2010 09:00 Jeff Roberson said the following:
> I think some people are enabling after returning to single user from a
> live system rather than booting into single user.  This is a different
> path in the filesystem as booting directly just mounts read-only while
> the other option updates a mount from read/write.  I believe this is the
> path that is broken.

Yes, this seems to be broken and perhaps by design.
g_vfs_open() calls g_access like this: g_access(cp, 1, wr, 1);
That means that 'e' count (exclusive) is always bumped, even for R/O mounts, and
that prevents opening the provider for writing.

ffs_mountfs has this special code:
/*
 * If we are a root mount, drop the E flag so fsck can do its magic.
 * We will pick it up again when we remount R/W.
 */
if (error == 0 && ronly && (mp->mnt_flag & MNT_ROOTFS))
        error = g_access(cp, 0, 0, -1);

So, basically for read-only UFS root mount we allow concurrent open, even for
writing.  This is needed primarily for fsck, but also helps tunefs.

But I believe that this code is exercised only during original mount.
Remounting to R/O at later time doesn't drop 'e' count.

I think that this is by design, to prevent foot-shooting.
We either should document this behavior or re-consider it.

-- 
Andriy Gapon


More information about the freebsd-current mailing list