Deleted Added
full compact
44c44
< __FBSDID("$FreeBSD: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c 269164 2014-07-28 00:43:42Z kib $");
---
> __FBSDID("$FreeBSD: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c 269175 2014-07-28 01:23:59Z kib $");
241c241
< error = tmpfs_alloc_node(tmp, VDIR, root_uid,
---
> error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid,
272,273d271
< int error;
< int flags = 0;
275a274
> int error, flags;
277,279c276,277
< /* Handle forced unmounts. */
< if (mntflags & MNT_FORCE)
< flags |= FORCECLOSE;
---
> flags = (mntflags & MNT_FORCE) != 0 ? FORCECLOSE : 0;
> tmp = VFS_TO_TMPFS(mp);
281,282c279,280
< /* Finalize all pending I/O. */
< error = vflush(mp, 0, flags, curthread);
---
> /* Stop writers */
> error = vfs_write_suspend_umnt(mp);
284c282,286
< return error;
---
> return (error);
> /*
> * At this point, nodes cannot be destroyed by any other
> * thread because write suspension is started.
> */
286c288,304
< tmp = VFS_TO_TMPFS(mp);
---
> for (;;) {
> error = vflush(mp, 0, flags, curthread);
> if (error != 0) {
> vfs_write_resume(mp, VR_START_WRITE);
> return (error);
> }
> MNT_ILOCK(mp);
> if (mp->mnt_nvnodelistsize == 0) {
> MNT_IUNLOCK(mp);
> break;
> }
> MNT_IUNLOCK(mp);
> if ((mntflags & MNT_FORCE) == 0) {
> vfs_write_resume(mp, VR_START_WRITE);
> return (EBUSY);
> }
> }
288,296c306,308
< /* Free all associated data. The loop iterates over the linked list
< * we have containing all used nodes. For each of them that is
< * a directory, we free all its directory entries. Note that after
< * freeing a node, it will automatically go to the available list,
< * so we will later have to iterate over it to release its items. */
< node = LIST_FIRST(&tmp->tm_nodes_used);
< while (node != NULL) {
< struct tmpfs_node *next;
<
---
> TMPFS_LOCK(tmp);
> while ((node = LIST_FIRST(&tmp->tm_nodes_used)) != NULL) {
> TMPFS_UNLOCK(tmp);
299,300d310
<
< next = LIST_NEXT(node, tn_entries);
302c312
< node = next;
---
> TMPFS_LOCK(tmp);
303a314
> TMPFS_UNLOCK(tmp);
315a327
> vfs_write_resume(mp, VR_START_WRITE);
320c332,333
< return 0;
---
>
> return (0);
403a417,428
> static int
> tmpfs_sync(struct mount *mp, int waitfor)
> {
>
> if (waitfor == MNT_SUSPEND) {
> MNT_ILOCK(mp);
> mp->mnt_kern_flag |= MNTK_SUSPEND2 | MNTK_SUSPENDED;
> MNT_IUNLOCK(mp);
> }
> return (0);
> }
>
413a439
> .vfs_sync = tmpfs_sync,