On Sun, Jul 24, 2011 at 06:27:09PM +0000, Kirk McKusick wrote:
> Author: mckusick
> Date: Sun Jul 24 18:27:09 2011
> New Revision: 224294
> URL: http://svn.freebsd.org/changeset/base/224294

> Log:
>   Move the MNTK_SUJ flag in mnt_kern_flag to MNT_SUJ in mnt_flag
>   so that it is visible to userland programs. This change enables
>   the `mount' command with no arguments to be able to show if a
>   filesystem is mounted using journaled soft updates as opposed
>   to just normal soft updates.

>   Approved by: re (bz)

[snip]
> Modified: head/sbin/mount/mount.c
> ==============================================================================
> --- head/sbin/mount/mount.c   Sun Jul 24 18:16:14 2011        (r224293)
> +++ head/sbin/mount/mount.c   Sun Jul 24 18:27:09 2011        (r224294)
[snip good change]
> @@ -316,7 +317,7 @@ main(int argc, char *argv[])
>       rval = 0;
>       switch (argc) {
>       case 0:
> -             if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
> +             if ((mntsize = getmntinfo(&mntbuf, MNT_WAIT)) == 0)
>                       err(1, "getmntinfo");
>               if (all) {
>                       while ((fs = getfsent()) != NULL) {
> @@ -665,7 +666,7 @@ getmntpt(const char *name)
>       struct statfs *mntbuf;
>       int i, mntsize;
>  
> -     mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
> +     mntsize = getmntinfo(&mntbuf, MNT_WAIT);
>       for (i = mntsize - 1; i >= 0; i--) {
>               if (strcmp(mntbuf[i].f_mntfromname, name) == 0 ||
>                   strcmp(mntbuf[i].f_mntonname, name) == 0)

These two hunks make it impossible (or at least very hard) to do
'mount', 'mount -p' or 'mount -u <fs>' while there is a non-responsive
NFS filesystem.

The effect of the lines appears to be avoiding both "soft-updates" and
"journaled soft-updates" texts in mount output. This is because the code
in kern_getfsstat() in sys/kern/vfs_syscalls.c copies mp->mnt_flag and
subsequently calls VFS_STATFS in the MNT_WAIT case:

%                       /*
%                        * Set these in case the underlying filesystem
%                        * fails to do so.
%                        */
%                       sp->f_version = STATFS_VERSION;
%                       sp->f_namemax = NAME_MAX;
%                       sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;

followed by code that will call VFS_STATFS(mp, sp) in the MNT_WAIT case.
Only in the latter case is MNT_SOFTDEP turned off if MNT_SUJ is on.

I don't think kern_getfsstat() should know about MNT_SOFTDEP and
MNT_SUJ, which would suggest giving up on preventing
MNT_SOFTDEP-with-MNT_SUJ in userland. However, what I care about is
mount(8) working while there are unrelated hung filesystems.

-- 
Jilles Tjoelker
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to