diff options
author | kib <kib@FreeBSD.org> | 2014-07-28 01:11:29 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2014-07-28 01:11:29 +0000 |
commit | 36fc0d1d01d4daafaceec2e99d0e54b7ac0bf960 (patch) | |
tree | 2416e661df9a3be1f068e4cc7648dad5712964b0 /sys/ufs/ffs | |
parent | 2ac333b7af936f53cccbc105f3b1d454fe3c5dc1 (diff) | |
download | FreeBSD-src-36fc0d1d01d4daafaceec2e99d0e54b7ac0bf960.zip FreeBSD-src-36fc0d1d01d4daafaceec2e99d0e54b7ac0bf960.tar.gz |
MFC r268612:
Add helper helper vfs_write_suspend_umnt().
Fix the bug in the FFS unmount, when suspension failed, the ufs
extattrs were not reinitialized.
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 51 |
1 files changed, 7 insertions, 44 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 3cc2a6d..3fd4512 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -255,31 +255,9 @@ ffs_mount(struct mount *mp) */ if ((error = vn_start_write(NULL, &mp, V_WAIT)) != 0) return (error); - for (;;) { - vn_finished_write(mp); - if ((error = vfs_write_suspend(mp, 0)) != 0) - return (error); - MNT_ILOCK(mp); - if (mp->mnt_kern_flag & MNTK_SUSPENDED) { - /* - * Allow the secondary writes - * to proceed. - */ - mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | - MNTK_SUSPEND2); - wakeup(&mp->mnt_flag); - MNT_IUNLOCK(mp); - /* - * Allow the curthread to - * ignore the suspension to - * synchronize on-disk state. - */ - td->td_pflags |= TDP_IGNSUSP; - break; - } - MNT_IUNLOCK(mp); - vn_start_write(NULL, &mp, V_WAIT); - } + error = vfs_write_suspend_umnt(mp); + if (error != 0) + return (error); /* * Check for and optionally get rid of files open * for writing. @@ -1250,25 +1228,9 @@ ffs_unmount(mp, mntflags) } #endif if (susp) { - /* - * dounmount already called vn_start_write(). - */ - for (;;) { - vn_finished_write(mp); - if ((error = vfs_write_suspend(mp, 0)) != 0) - return (error); - MNT_ILOCK(mp); - if (mp->mnt_kern_flag & MNTK_SUSPENDED) { - mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | - MNTK_SUSPEND2); - wakeup(&mp->mnt_flag); - MNT_IUNLOCK(mp); - td->td_pflags |= TDP_IGNSUSP; - break; - } - MNT_IUNLOCK(mp); - vn_start_write(NULL, &mp, V_WAIT); - } + error = vfs_write_suspend_umnt(mp); + if (error != 0) + goto fail1; } if (MOUNTEDSOFTDEP(mp)) error = softdep_flushfiles(mp, flags, td); @@ -1331,6 +1293,7 @@ ffs_unmount(mp, mntflags) fail: if (susp) vfs_write_resume(mp, VR_START_WRITE); +fail1: #ifdef UFS_EXTATTR if (e_restart) { ufs_extattr_uepm_init(&ump->um_extattr); |