Deleted Added
full compact
ffs_suspend.c (274906) ffs_suspend.c (283735)
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/ufs/ffs/ffs_suspend.c 274906 2014-11-23 01:01:14Z glebius $
29 * $FreeBSD: head/sys/ufs/ffs/ffs_suspend.c 283735 2015-05-29 13:24:17Z kib $
30 */
31
32#include <sys/cdefs.h>
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/ufs/ffs/ffs_suspend.c 274906 2014-11-23 01:01:14Z glebius $");
33__FBSDID("$FreeBSD: head/sys/ufs/ffs/ffs_suspend.c 283735 2015-05-29 13:24:17Z kib $");
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/buf.h>
38#include <sys/ioccom.h>
39#include <sys/mount.h>
40#include <sys/vnode.h>
41#include <sys/conf.h>

--- 130 unchanged lines hidden (view full) ---

172 return (0);
173
174 return (error);
175}
176
177static int
178ffs_susp_suspend(struct mount *mp)
179{
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/buf.h>
38#include <sys/ioccom.h>
39#include <sys/mount.h>
40#include <sys/vnode.h>
41#include <sys/conf.h>

--- 130 unchanged lines hidden (view full) ---

172 return (0);
173
174 return (error);
175}
176
177static int
178ffs_susp_suspend(struct mount *mp)
179{
180 struct fs *fs;
181 struct ufsmount *ump;
182 int error;
183
184 sx_assert(&ffs_susp_lock, SA_XLOCKED);
185
186 if (!ffs_own_mount(mp))
187 return (EINVAL);
188 if (ffs_susp_suspended(mp))
189 return (EBUSY);
190
191 ump = VFSTOUFS(mp);
180 struct ufsmount *ump;
181 int error;
182
183 sx_assert(&ffs_susp_lock, SA_XLOCKED);
184
185 if (!ffs_own_mount(mp))
186 return (EINVAL);
187 if (ffs_susp_suspended(mp))
188 return (EBUSY);
189
190 ump = VFSTOUFS(mp);
192 fs = ump->um_fs;
193
194 /*
195 * Make sure the calling thread is permitted to access the mounted
196 * device. The permissions can change after we unlock the vnode;
197 * it's harmless.
198 */
199 vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
200 error = VOP_ACCESS(ump->um_devvp, VREAD | VWRITE,

--- 139 unchanged lines hidden ---
191
192 /*
193 * Make sure the calling thread is permitted to access the mounted
194 * device. The permissions can change after we unlock the vnode;
195 * it's harmless.
196 */
197 vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
198 error = VOP_ACCESS(ump->um_devvp, VREAD | VWRITE,

--- 139 unchanged lines hidden ---