Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jul 2011 00:43:18 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224503 - in head: sbin/mount sys/ufs/ffs sys/ufs/ufs
Message-ID:  <201107300043.p6U0hIq3072663@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Sat Jul 30 00:43:18 2011
New Revision: 224503
URL: http://svn.freebsd.org/changeset/base/224503

Log:
  Update to -r224294 to ensure that only one of MNT_SUJ or MNT_SOFTDEP
  is set so that mount can revert back to using MNT_NOWAIT when doing
  getmntinfo.
  
  Approved by: re (kib)

Modified:
  head/sbin/mount/mount.c
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/ffs_vfsops.c
  head/sys/ufs/ffs/ffs_vnops.c
  head/sys/ufs/ufs/inode.h

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Fri Jul 29 23:55:17 2011	(r224502)
+++ head/sbin/mount/mount.c	Sat Jul 30 00:43:18 2011	(r224503)
@@ -317,7 +317,7 @@ main(int argc, char *argv[])
 	rval = 0;
 	switch (argc) {
 	case 0:
-		if ((mntsize = getmntinfo(&mntbuf, MNT_WAIT)) == 0)
+		if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
 			err(1, "getmntinfo");
 		if (all) {
 			while ((fs = getfsent()) != NULL) {
@@ -666,7 +666,7 @@ getmntpt(const char *name)
 	struct statfs *mntbuf;
 	int i, mntsize;
 
-	mntsize = getmntinfo(&mntbuf, MNT_WAIT);
+	mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
 	for (i = mntsize - 1; i >= 0; i--) {
 		if (strcmp(mntbuf[i].f_mntfromname, name) == 0 ||
 		    strcmp(mntbuf[i].f_mntonname, name) == 0)

Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c	Fri Jul 29 23:55:17 2011	(r224502)
+++ head/sys/ufs/ffs/ffs_alloc.c	Sat Jul 30 00:43:18 2011	(r224503)
@@ -1967,7 +1967,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size
 	ACTIVECLEAR(fs, cg);
 	UFS_UNLOCK(ump);
 	mp = UFSTOVFS(ump);
-	if (mp->mnt_flag & MNT_SOFTDEP && devvp->v_type != VREG)
+	if (MOUNTEDSOFTDEP(mp) && devvp->v_type != VREG)
 		softdep_setup_blkfree(UFSTOVFS(ump), bp, bno,
 		    numfrags(fs, size), dephd);
 	bdwrite(bp);
@@ -2217,7 +2217,7 @@ ffs_freefile(ump, fs, devvp, ino, mode, 
 	fs->fs_fmod = 1;
 	ACTIVECLEAR(fs, cg);
 	UFS_UNLOCK(ump);
-	if (UFSTOVFS(ump)->mnt_flag & MNT_SOFTDEP && devvp->v_type != VREG)
+	if (MOUNTEDSOFTDEP(UFSTOVFS(ump)) && devvp->v_type != VREG)
 		softdep_setup_inofree(UFSTOVFS(ump), bp,
 		    ino + cg * fs->fs_ipg, wkhd);
 	bdwrite(bp);

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c	Fri Jul 29 23:55:17 2011	(r224502)
+++ head/sys/ufs/ffs/ffs_softdep.c	Sat Jul 30 00:43:18 2011	(r224503)
@@ -1364,7 +1364,7 @@ softdep_flush(void)
 		mtx_lock(&mountlist_mtx);
 		for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp)  {
 			nmp = TAILQ_NEXT(mp, mnt_list);
-			if ((mp->mnt_flag & MNT_SOFTDEP) == 0)
+			if (MOUNTEDSOFTDEP(mp) == 0)
 				continue;
 			if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK))
 				continue;
@@ -2423,7 +2423,7 @@ softdep_unmount(mp)
 
 	MNT_ILOCK(mp);
 	mp->mnt_flag &= ~MNT_SOFTDEP;
-	if ((mp->mnt_flag & MNT_SUJ) == 0) {
+	if (MOUNTEDSUJ(mp) == 0) {
 		MNT_IUNLOCK(mp);
 		return;
 	}
@@ -2638,6 +2638,7 @@ out:
 	if (error == 0) {
 		MNT_ILOCK(mp);
 		mp->mnt_flag |= MNT_SUJ;
+		mp->mnt_flag &= ~MNT_SOFTDEP;
 		MNT_IUNLOCK(mp);
 		/*
 		 * Only validate the journal contents if the
@@ -3060,7 +3061,7 @@ softdep_flushjournal(mp)
 	struct jblocks *jblocks;
 	struct ufsmount *ump;
 
-	if ((mp->mnt_flag & MNT_SUJ) == 0)
+	if (MOUNTEDSUJ(mp) == 0)
 		return;
 	ump = VFSTOUFS(mp);
 	jblocks = ump->softdep_jblocks;
@@ -3096,7 +3097,7 @@ softdep_process_journal(mp, needwk, flag
 	int off;
 	int devbsize;
 
-	if ((mp->mnt_flag & MNT_SUJ) == 0)
+	if (MOUNTEDSUJ(mp) == 0)
 		return;
 	ump = VFSTOUFS(mp);
 	fs = ump->um_fs;
@@ -3827,8 +3828,8 @@ newfreework(ump, freeblks, parent, lbn, 
 	freework->fw_blkno = nb;
 	freework->fw_frags = frags;
 	freework->fw_indir = NULL;
-	freework->fw_ref = ((UFSTOVFS(ump)->mnt_flag & MNT_SUJ) == 0 ||
-	    lbn >= -NXADDR) ? 0 : NINDIR(ump->um_fs) + 1;
+	freework->fw_ref = (MOUNTEDSUJ(UFSTOVFS(ump)) == 0 || lbn >= -NXADDR)
+		? 0 : NINDIR(ump->um_fs) + 1;
 	freework->fw_start = freework->fw_off = off;
 	if (journal)
 		newjfreeblk(freeblks, lbn, nb, frags);
@@ -4681,7 +4682,7 @@ softdep_setup_inomapdep(bp, ip, newinum,
 	 * Allocate the journal reference add structure so that the bitmap
 	 * can be dependent on it.
 	 */
-	if (mp->mnt_flag & MNT_SUJ) {
+	if (MOUNTEDSUJ(mp)) {
 		jaddref = newjaddref(ip, newinum, 0, 0, mode);
 		jaddref->ja_state |= NEWBLOCK;
 	}
@@ -4734,7 +4735,7 @@ softdep_setup_blkmapdep(bp, mp, newblkno
 	 * Add it to the dependency list for the buffer holding
 	 * the cylinder group map from which it was allocated.
 	 */
-	if (mp->mnt_flag & MNT_SUJ) {
+	if (MOUNTEDSUJ(mp)) {
 		jnewblk = malloc(sizeof(*jnewblk), M_JNEWBLK, M_SOFTDEP_FLAGS);
 		workitem_alloc(&jnewblk->jn_list, D_JNEWBLK, mp);
 		jnewblk->jn_jsegdep = newjsegdep(&jnewblk->jn_list);
@@ -5199,7 +5200,7 @@ newfreefrag(ip, blkno, size, lbn)
 	freefrag->ff_blkno = blkno;
 	freefrag->ff_fragsize = size;
 
-	if ((ip->i_ump->um_mountp->mnt_flag & MNT_SUJ) != 0) {
+	if (MOUNTEDSUJ(UFSTOVFS(ip->i_ump))) {
 		freefrag->ff_jdep = (struct worklist *)
 		    newjfreefrag(freefrag, ip, blkno, size, lbn);
 	} else {
@@ -7254,7 +7255,7 @@ freework_freeblock(freework)
 	freeblks = freework->fw_freeblks;
 	ump = VFSTOUFS(freeblks->fb_list.wk_mp);
 	fs = ump->um_fs;
-	needj = (freeblks->fb_list.wk_mp->mnt_flag & MNT_SUJ) != 0;
+	needj = MOUNTEDSUJ(freeblks->fb_list.wk_mp) != 0;
 	bsize = lfragtosize(fs, freework->fw_frags);
 	LIST_INIT(&wkhd);
 	/*
@@ -7674,7 +7675,7 @@ indir_trunc(freework, dbn, lbn)
 		ufs1fmt = 0;
 	}
 	level = lbn_level(lbn);
-	needj = (UFSTOVFS(ump)->mnt_flag & MNT_SUJ) != 0;
+	needj = MOUNTEDSUJ(UFSTOVFS(ump)) != 0;
 	lbnadd = lbn_offset(fs, level);
 	nblocks = btodb(fs->fs_bsize);
 	nfreework = freework;
@@ -7860,7 +7861,7 @@ setup_newdir(dap, newinum, dinum, newdir
 	mkdir2->md_state = ATTACHED | MKDIR_PARENT;
 	mkdir2->md_diradd = dap;
 	mkdir2->md_jaddref = NULL;
-	if ((mp->mnt_flag & MNT_SUJ) == 0) {
+	if (MOUNTEDSUJ(mp) == 0) {
 		mkdir1->md_state |= DEPCOMPLETE;
 		mkdir2->md_state |= DEPCOMPLETE;
 	}
@@ -7900,7 +7901,7 @@ setup_newdir(dap, newinum, dinum, newdir
 	 * been satisfied and mkdir2 can be freed.
 	 */
 	inodedep_lookup(mp, dinum, 0, &inodedep);
-	if (mp->mnt_flag & MNT_SUJ) {
+	if (MOUNTEDSUJ(mp)) {
 		if (inodedep == NULL)
 			panic("setup_newdir: Lost parent.");
 		jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst,
@@ -8031,7 +8032,7 @@ softdep_setup_directory_add(bp, dp, diro
 	 * written place it on the bufwait list, otherwise do the post-inode
 	 * write processing to put it on the id_pendinghd list.
 	 */
-	if (mp->mnt_flag & MNT_SUJ) {
+	if (MOUNTEDSUJ(mp)) {
 		jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst,
 		    inoreflst);
 		KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number,
@@ -8047,7 +8048,7 @@ softdep_setup_directory_add(bp, dp, diro
 	 * Add the journal entries for . and .. links now that the primary
 	 * link is written.
 	 */
-	if (mkdir1 != NULL && (mp->mnt_flag & MNT_SUJ)) {
+	if (mkdir1 != NULL && MOUNTEDSUJ(mp)) {
 		jaddref = (struct jaddref *)TAILQ_PREV(&jaddref->ja_ref,
 		    inoreflst, if_deps);
 		KASSERT(jaddref != NULL &&
@@ -8144,7 +8145,7 @@ softdep_change_directoryentry_offset(bp,
 	 * determine if any affected adds or removes are present in the
 	 * journal.
 	 */
-	if (mp->mnt_flag & MNT_SUJ)  {
+	if (MOUNTEDSUJ(mp)) {
 		flags = DEPALLOC;
 		jmvref = newjmvref(dp, de->d_ino,
 		    dp->i_offset + (oldloc - base),
@@ -8865,7 +8866,7 @@ softdep_setup_directory_change(bp, dp, i
 	 * processing to put it on the id_pendinghd list.
 	 */
 	inodedep_lookup(mp, newinum, DEPALLOC, &inodedep);
-	if (mp->mnt_flag & MNT_SUJ) {
+	if (MOUNTEDSUJ(mp)) {
 		jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst,
 		    inoreflst);
 		KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number,
@@ -8928,7 +8929,7 @@ softdep_setup_sbupdate(ump, fs, bp)
 	struct sbdep *sbdep;
 	struct worklist *wk;
 
-	if ((ump->um_mountp->mnt_flag & MNT_SUJ) == 0)
+	if (MOUNTEDSUJ(UFSTOVFS(ump)) == 0)
 		return;
 	LIST_FOREACH(wk, &bp->b_dep, wk_list)
 		if (wk->wk_type == D_SBDEP)
@@ -9046,7 +9047,7 @@ unlinked_inodedep(mp, inodedep)
 {
 	struct ufsmount *ump;
 
-	if ((mp->mnt_flag & MNT_SUJ) == 0)
+	if (MOUNTEDSUJ(mp) == 0)
 		return;
 	ump = VFSTOUFS(mp);
 	ump->um_fs->fs_fmod = 1;

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Fri Jul 29 23:55:17 2011	(r224502)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Sat Jul 30 00:43:18 2011	(r224503)
@@ -281,7 +281,7 @@ ffs_mount(struct mount *mp)
 			flags = WRITECLOSE;
 			if (mp->mnt_flag & MNT_FORCE)
 				flags |= FORCECLOSE;
-			if (mp->mnt_flag & MNT_SOFTDEP) {
+			if (MOUNTEDSOFTDEP(mp)) {
 				error = softdep_flushfiles(mp, flags, td);
 			} else {
 				error = ffs_flushfiles(mp, flags, td);
@@ -307,7 +307,7 @@ ffs_mount(struct mount *mp)
 				vfs_write_resume(mp);
 				return (error);
 			}
-			if (mp->mnt_flag & MNT_SOFTDEP)
+			if (MOUNTEDSOFTDEP(mp))
 				softdep_unmount(mp);
 			DROP_GIANT();
 			g_topology_lock();
@@ -411,7 +411,7 @@ ffs_mount(struct mount *mp)
 		 * Softdep_mount() clears it in an initial mount
 		 * or ro->rw remount.
 		 */
-		if (mp->mnt_flag & MNT_SOFTDEP) {
+		if (MOUNTEDSOFTDEP(mp)) {
 			/* XXX: Reset too late ? */
 			MNT_ILOCK(mp);
 			mp->mnt_flag &= ~MNT_ASYNC;
@@ -443,7 +443,7 @@ ffs_mount(struct mount *mp)
 				    fs->fs_fsmnt);
 				return (EINVAL);
 			}
-			KASSERT((mp->mnt_flag & MNT_SOFTDEP) == 0,
+			KASSERT(MOUNTEDSOFTDEP(mp) == 0,
 			    ("soft updates enabled on read-only file system"));
 			DROP_GIANT();
 			g_topology_lock();
@@ -530,7 +530,7 @@ ffs_mount(struct mount *mp)
 			return (error);
 		}
 		if (fsckpid > 0) {
-			KASSERT((mp->mnt_flag & MNT_SOFTDEP) == 0,
+			KASSERT(MOUNTEDSOFTDEP(mp) == 0,
 			    ("soft updates enabled on read-only file system"));
 			ump = VFSTOUFS(mp);
 			fs = ump->um_fs;
@@ -1247,7 +1247,7 @@ ffs_unmount(mp, mntflags)
 			vn_start_write(NULL, &mp, V_WAIT);
 		}
 	}
-	if (mp->mnt_flag & MNT_SOFTDEP)
+	if (MOUNTEDSOFTDEP(mp))
 		error = softdep_flushfiles(mp, flags, td);
 	else
 		error = ffs_flushfiles(mp, flags, td);
@@ -1389,9 +1389,6 @@ ffs_statfs(mp, sbp)
 	fs = ump->um_fs;
 	if (fs->fs_magic != FS_UFS1_MAGIC && fs->fs_magic != FS_UFS2_MAGIC)
 		panic("ffs_statfs");
-	/* Don't export MNT_SOFTDEP when MNT_SUJ is in use */
-	if ((sbp->f_flags & (MNT_SOFTDEP | MNT_SUJ)) == (MNT_SOFTDEP | MNT_SUJ))
-		sbp->f_flags &= ~MNT_SOFTDEP;
 	sbp->f_version = STATFS_VERSION;
 	sbp->f_bsize = fs->fs_fsize;
 	sbp->f_iosize = fs->fs_bsize;

Modified: head/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vnops.c	Fri Jul 29 23:55:17 2011	(r224502)
+++ head/sys/ufs/ffs/ffs_vnops.c	Sat Jul 30 00:43:18 2011	(r224503)
@@ -187,8 +187,7 @@ retry:
 	error = ffs_syncvnode(vp, ap->a_waitfor);
 	if (error)
 		return (error);
-	if (ap->a_waitfor == MNT_WAIT &&
-	    (vp->v_mount->mnt_flag & MNT_SOFTDEP)) {
+	if (ap->a_waitfor == MNT_WAIT && DOINGSOFTDEP(vp)) {
 		error = softdep_fsync(vp);
 		if (error)
 			return (error);

Modified: head/sys/ufs/ufs/inode.h
==============================================================================
--- head/sys/ufs/ufs/inode.h	Fri Jul 29 23:55:17 2011	(r224502)
+++ head/sys/ufs/ufs/inode.h	Sat Jul 30 00:43:18 2011	(r224503)
@@ -174,9 +174,11 @@ struct indir {
 #define ITOV(ip)	((ip)->i_vnode)
 
 /* Determine if soft dependencies are being done */
-#define DOINGSOFTDEP(vp)	((vp)->v_mount->mnt_flag & MNT_SOFTDEP)
-#define DOINGASYNC(vp)		((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC)
-#define DOINGSUJ(vp)		((vp)->v_mount->mnt_flag & MNT_SUJ)
+#define DOINGSOFTDEP(vp)   ((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ))
+#define MOUNTEDSOFTDEP(mp) ((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ))
+#define DOINGASYNC(vp)	   ((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC)
+#define DOINGSUJ(vp)	   ((vp)->v_mount->mnt_flag & MNT_SUJ)
+#define MOUNTEDSUJ(mp)	   ((mp)->mnt_flag & MNT_SUJ)
 
 /* This overlays the fid structure (see mount.h). */
 struct ufid {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107300043.p6U0hIq3072663>