Author: trasz
Date: Sat Oct 29 12:38:30 2016
New Revision: 308088
URL: https://svnweb.freebsd.org/changeset/base/308088

Log:
  Fix getfsstat(2) handling of flags. The 'flags' argument is an enum,
  not a bitfield. For the intended usage - being passed either MNT_WAIT,
  or MNT_NOWAIT - this shouldn't introduce any changes in behaviour.
  
  Reviewed by:  jhb@
  MFC after:    1 month
  Differential Revision:        https://reviews.freebsd.org/D8373

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c        Sat Oct 29 08:57:35 2016        
(r308087)
+++ head/sys/kern/vfs_syscalls.c        Sat Oct 29 12:38:30 2016        
(r308088)
@@ -495,16 +495,16 @@ kern_getfsstat(struct thread *td, struct
                        sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
                        /*
                         * If MNT_NOWAIT or MNT_LAZY is specified, do not
-                        * refresh the fsstat cache. MNT_NOWAIT or MNT_LAZY
-                        * overrides MNT_WAIT.
+                        * refresh the fsstat cache.
                         */
-                       if (((flags & (MNT_LAZY|MNT_NOWAIT)) == 0 ||
-                           (flags & MNT_WAIT)) &&
-                           (error = VFS_STATFS(mp, sp))) {
-                               mtx_lock(&mountlist_mtx);
-                               nmp = TAILQ_NEXT(mp, mnt_list);
-                               vfs_unbusy(mp);
-                               continue;
+                       if (flags != MNT_LAZY && flags != MNT_NOWAIT) {
+                               error = VFS_STATFS(mp, sp);
+                               if (error != 0) {
+                                       mtx_lock(&mountlist_mtx);
+                                       nmp = TAILQ_NEXT(mp, mnt_list);
+                                       vfs_unbusy(mp);
+                                       continue;
+                               }
                        }
                        if (priv_check(td, PRIV_VFS_GENERATION)) {
                                bcopy(sp, &sb, sizeof(sb));
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to