ffs_vfsops.c (10027) | ffs_vfsops.c (10358) |
---|---|
1/* 2 * Copyright (c) 1989, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 | 1/* 2 * Copyright (c) 1989, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 |
34 * $Id: ffs_vfsops.c,v 1.26 1995/08/06 11:56:42 davidg Exp $ | 34 * $Id: ffs_vfsops.c,v 1.27 1995/08/11 11:31:15 davidg Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/namei.h> 40#include <sys/proc.h> 41#include <sys/kernel.h> 42#include <sys/vnode.h> --- 39 unchanged lines hidden (view full) --- 82 ffs_vptofh, 83 ffs_init, 84}; 85 86VFS_SET(ufs_vfsops, ufs, MOUNT_UFS, 0); 87 88extern u_long nextgennumber; 89 | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/namei.h> 40#include <sys/proc.h> 41#include <sys/kernel.h> 42#include <sys/vnode.h> --- 39 unchanged lines hidden (view full) --- 82 ffs_vptofh, 83 ffs_init, 84}; 85 86VFS_SET(ufs_vfsops, ufs, MOUNT_UFS, 0); 87 88extern u_long nextgennumber; 89 |
90 |
|
90/* | 91/* |
91 * Called by main() when ufs is going to be mounted as root. | 92 * ffs_mount |
92 * | 93 * |
93 * Name is updated by mount(8) after booting. | 94 * Called when mounting local physical media 95 * 96 * PARAMETERS: 97 * mountroot 98 * mp mount point structure 99 * path NULL (flag for root mount!!!) 100 * data <unused> 101 * ndp <unused> 102 * p process (user credentials check [statfs]) 103 * 104 * mount 105 * mp mount point structure 106 * path path to mount point 107 * data pointer to argument struct in user space 108 * ndp mount point namei() return (used for 109 * credentials on reload), reused to look 110 * up block device. 111 * p process (user credentials check) 112 * 113 * RETURNS: 0 Success 114 * !0 error number (errno.h) 115 * 116 * LOCK STATE: 117 * 118 * ENTRY 119 * mount point is locked 120 * EXIT 121 * mount point is locked 122 * 123 * NOTES: 124 * A NULL path can be used for a flag since the mount 125 * system call will fail with EFAULT in copyinstr in 126 * namei() if it is a genuine NULL from the user. |
94 */ | 127 */ |
95#define ROOTNAME "root_device" 96 | |
97int | 128int |
98ffs_mountroot() | 129ffs_mount( mp, path, data, ndp, p) 130 register struct mount *mp; /* mount struct pointer*/ 131 char *path; /* path to mount point*/ 132 caddr_t data; /* arguments to FS specific mount*/ 133 struct nameidata *ndp; /* mount point credentials*/ 134 struct proc *p; /* process requesting mount*/ |
99{ | 135{ |
136 u_int size; 137 int err = 0; 138 struct vnode *devvp; 139 140 struct ufs_args args; 141 struct ufsmount *ump = 0; |
|
100 register struct fs *fs; | 142 register struct fs *fs; |
101 register struct mount *mp; 102 struct proc *p = curproc; /* XXX */ 103 struct ufsmount *ump; 104 u_int size; 105 int error; | 143 int flags; |
106 107 /* | 144 145 /* |
108 * Get vnode for rootdev. | 146 * Use NULL path to flag a root mount |
109 */ | 147 */ |
110 if (bdevvp(rootdev, &rootvp)) 111 panic("ffs_mountroot: can't setup bdevvp for root"); | 148 if( path == NULL) { 149 /* 150 *** 151 * Mounting root file system 152 *** 153 */ 154 155 /* Get vnode for root device*/ 156 if( bdevvp( rootdev, &rootvp)) 157 panic("ffs_mountroot: can't setup bdevvp for root"); |
112 | 158 |
113 mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK); 114 bzero((char *)mp, (u_long)sizeof(struct mount)); 115 mp->mnt_op = &ufs_vfsops; 116 mp->mnt_flag = MNT_RDONLY; 117 error = ffs_mountfs(rootvp, mp, p); 118 if (error) { 119 free(mp, M_MOUNT); 120 return (error); | 159 /* 160 * FS specific handling 161 */ 162 mp->mnt_flag |= MNT_RDONLY; /* XXX globally applicable?*/ 163 164 /* 165 * Attempt mount 166 */ 167 if( ( err = ffs_mountfs(rootvp, mp, p)) != 0) { 168 /* fs specific cleanup (if any)*/ 169 goto error_1; 170 } 171 172 goto dostatfs; /* success*/ 173 |
121 } | 174 } |
122 error = vfs_lock(mp); 123 if (error) { 124 (void)ffs_unmount(mp, 0, p); 125 free(mp, M_MOUNT); 126 return (error); 127 } 128 CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); 129 mp->mnt_flag |= MNT_ROOTFS; 130 mp->mnt_vnodecovered = NULLVP; 131 ump = VFSTOUFS(mp); 132 fs = ump->um_fs; 133 bzero(fs->fs_fsmnt, sizeof(fs->fs_fsmnt)); 134 fs->fs_fsmnt[0] = '/'; 135 bcopy((caddr_t)fs->fs_fsmnt, (caddr_t)mp->mnt_stat.f_mntonname, 136 MNAMELEN); 137 (void) copystr(ROOTNAME, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, 138 &size); 139 bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); 140 (void)ffs_statfs(mp, &mp->mnt_stat, p); 141 vfs_unlock(mp); 142 inittodr(fs->fs_time); 143 return (0); 144} | |
145 | 175 |
146/* 147 * VFS Operations. 148 * 149 * mount system call 150 */ 151int 152ffs_mount(mp, path, data, ndp, p) 153 register struct mount *mp; 154 char *path; 155 caddr_t data; 156 struct nameidata *ndp; 157 struct proc *p; 158{ 159 struct vnode *devvp; 160 struct ufs_args args; 161 struct ufsmount *ump = 0; 162 register struct fs *fs; 163 u_int size; 164 int error, flags; | 176 /* 177 *** 178 * Mounting non-root file system or updating a file system 179 *** 180 */ |
165 | 181 |
166 error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args)); 167 if (error) 168 return (error); | 182 /* copy in user arguments*/ 183 err = copyin(data, (caddr_t)&args, sizeof (struct ufs_args)); 184 if (err) 185 goto error_1; /* can't get arguments*/ 186 |
169 /* 170 * If updating, check whether changing from read-only to 171 * read/write; if there is no device name, that's all we do. 172 */ 173 if (mp->mnt_flag & MNT_UPDATE) { 174 ump = VFSTOUFS(mp); 175 fs = ump->um_fs; | 187 /* 188 * If updating, check whether changing from read-only to 189 * read/write; if there is no device name, that's all we do. 190 */ 191 if (mp->mnt_flag & MNT_UPDATE) { 192 ump = VFSTOUFS(mp); 193 fs = ump->um_fs; |
176 error = 0; | 194 err = 0; |
177 if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { 178 flags = WRITECLOSE; 179 if (mp->mnt_flag & MNT_FORCE) 180 flags |= FORCECLOSE; | 195 if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { 196 flags = WRITECLOSE; 197 if (mp->mnt_flag & MNT_FORCE) 198 flags |= FORCECLOSE; |
181 if (vfs_busy(mp)) 182 return (EBUSY); 183 error = ffs_flushfiles(mp, flags, p); | 199 if (vfs_busy(mp)) { 200 err = EBUSY; 201 goto error_1; 202 } 203 err = ffs_flushfiles(mp, flags, p); |
184 vfs_unbusy(mp); 185 } | 204 vfs_unbusy(mp); 205 } |
186 if (!error && (mp->mnt_flag & MNT_RELOAD)) 187 error = ffs_reload(mp, ndp->ni_cnd.cn_cred, p); 188 if (error) 189 return (error); | 206 if (!err && (mp->mnt_flag & MNT_RELOAD)) 207 err = ffs_reload(mp, ndp->ni_cnd.cn_cred, p); 208 if (err) { 209 goto error_1; 210 } |
190 if (fs->fs_ronly && (mp->mnt_flag & MNT_WANTRDWR)) { 191 if (!fs->fs_clean) { 192 if (mp->mnt_flag & MNT_FORCE) { 193 printf("WARNING: %s was not properly dismounted.\n",fs->fs_fsmnt); 194 } else { 195 printf("WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck.\n", 196 fs->fs_fsmnt); | 211 if (fs->fs_ronly && (mp->mnt_flag & MNT_WANTRDWR)) { 212 if (!fs->fs_clean) { 213 if (mp->mnt_flag & MNT_FORCE) { 214 printf("WARNING: %s was not properly dismounted.\n",fs->fs_fsmnt); 215 } else { 216 printf("WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck.\n", 217 fs->fs_fsmnt); |
197 return (EPERM); | 218 err = EPERM; 219 goto error_1; |
198 } 199 } 200 fs->fs_ronly = 0; 201 } 202 if (fs->fs_ronly == 0) { 203 fs->fs_clean = 0; 204 ffs_sbupdate(ump, MNT_WAIT); 205 } | 220 } 221 } 222 fs->fs_ronly = 0; 223 } 224 if (fs->fs_ronly == 0) { 225 fs->fs_clean = 0; 226 ffs_sbupdate(ump, MNT_WAIT); 227 } |
228 /* if not updating name...*/ |
|
206 if (args.fspec == 0) { 207 /* | 229 if (args.fspec == 0) { 230 /* |
208 * Process export requests. | 231 * Process export requests. Jumping to "success" 232 * will return the vfs_export() error code. |
209 */ | 233 */ |
210 return (vfs_export(mp, &ump->um_export, &args.export)); | 234 err = vfs_export(mp, &ump->um_export, &args.export); 235 goto success; |
211 } 212 } | 236 } 237 } |
238 |
|
213 /* 214 * Not an update, or updating the name: look up the name 215 * and verify that it refers to a sensible block device. 216 */ 217 NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); | 239 /* 240 * Not an update, or updating the name: look up the name 241 * and verify that it refers to a sensible block device. 242 */ 243 NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); |
218 error = namei(ndp); 219 if (error) 220 return (error); | 244 err = namei(ndp); 245 if (err) { 246 /* can't get devvp!*/ 247 goto error_1; 248 } 249 |
221 devvp = ndp->ni_vp; 222 223 if (devvp->v_type != VBLK) { | 250 devvp = ndp->ni_vp; 251 252 if (devvp->v_type != VBLK) { |
224 vrele(devvp); 225 return (ENOTBLK); | 253 err = ENOTBLK; 254 goto error_2; |
226 } 227 if (major(devvp->v_rdev) >= nblkdev) { | 255 } 256 if (major(devvp->v_rdev) >= nblkdev) { |
228 vrele(devvp); 229 return (ENXIO); | 257 err = ENXIO; 258 goto error_2; |
230 } | 259 } |
231 if ((mp->mnt_flag & MNT_UPDATE) == 0) 232 error = ffs_mountfs(devvp, mp, p); 233 else { | 260 if (mp->mnt_flag & MNT_UPDATE) { 261 /* 262 ******************** 263 * UPDATE 264 ******************** 265 */ 266 |
234 if (devvp != ump->um_devvp) | 267 if (devvp != ump->um_devvp) |
235 error = EINVAL; /* needs translation */ | 268 err = EINVAL; /* needs translation */ |
236 else 237 vrele(devvp); | 269 else 270 vrele(devvp); |
271 /* 272 * Update device name only on success 273 */ 274 if( !err) { 275 /* Save "mounted from" info for mount point (NULL pad)*/ 276 copyinstr( args.fspec, 277 mp->mnt_stat.f_mntfromname, 278 MNAMELEN - 1, 279 &size); 280 bzero( mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); 281 } 282 } else { 283 /* 284 ******************** 285 * NEW MOUNT 286 ******************** 287 */ 288 289 /* 290 * Since this is a new mount, we want the names for 291 * the device and the mount point copied in. If an 292 * error occurs, the mountpoint is discarded by the 293 * upper level code. 294 */ 295 /* Save "last mounted on" info for mount point (NULL pad)*/ 296 copyinstr( path, /* mount point*/ 297 mp->mnt_stat.f_mntonname, /* save area*/ 298 MNAMELEN - 1, /* max size*/ 299 &size); /* real size*/ 300 bzero( mp->mnt_stat.f_mntonname + size, MNAMELEN - size); 301 302 /* Save "mounted from" info for mount point (NULL pad)*/ 303 copyinstr( args.fspec, /* device name*/ 304 mp->mnt_stat.f_mntfromname, /* save area*/ 305 MNAMELEN - 1, /* max size*/ 306 &size); /* real size*/ 307 bzero( mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); 308 309 err = ffs_mountfs(devvp, mp, p); |
|
238 } | 310 } |
239 if (error) { 240 vrele(devvp); 241 return (error); | 311 if (err) { 312 goto error_2; |
242 } | 313 } |
243 ump = VFSTOUFS(mp); 244 fs = ump->um_fs; 245 (void) copyinstr(path, fs->fs_fsmnt, sizeof(fs->fs_fsmnt) - 1, &size); 246 bzero(fs->fs_fsmnt + size, sizeof(fs->fs_fsmnt) - size); 247 bcopy((caddr_t)fs->fs_fsmnt, (caddr_t)mp->mnt_stat.f_mntonname, 248 MNAMELEN); 249 (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, 250 &size); 251 bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); 252 (void)ffs_statfs(mp, &mp->mnt_stat, p); 253 return (0); | 314 315dostatfs: 316 /* 317 * Initialize FS stat information in mount struct; uses both 318 * mp->mnt_stat.f_mntonname and mp->mnt_stat.f_mntfromname 319 * 320 * This code is common to root and non-root mounts 321 */ 322 (void)VFS_STATFS(mp, &mp->mnt_stat, p); 323 324 goto success; 325 326 327error_2: /* error with devvp held*/ 328 329 /* release devvp before failing*/ 330 vrele(devvp); 331 332error_1: /* no state to back out*/ 333 334success: 335 return( err); |
254} 255 | 336} 337 |
338 |
|
256/* 257 * Reload all incore data for a filesystem (used after running fsck on 258 * the root filesystem and finding things to fix). The filesystem must 259 * be mounted read-only. 260 * 261 * Things to do to update the mount: 262 * 1) invalidate all cached meta-data. 263 * 2) re-read superblock from disk. 264 * 3) re-read summary information from disk. 265 * 4) invalidate all inactive vnodes. 266 * 5) invalidate all cached file data. 267 * 6) re-read inode data for all active vnodes. 268 */ 269int | 339/* 340 * Reload all incore data for a filesystem (used after running fsck on 341 * the root filesystem and finding things to fix). The filesystem must 342 * be mounted read-only. 343 * 344 * Things to do to update the mount: 345 * 1) invalidate all cached meta-data. 346 * 2) re-read superblock from disk. 347 * 3) re-read summary information from disk. 348 * 4) invalidate all inactive vnodes. 349 * 5) invalidate all cached file data. 350 * 6) re-read inode data for all active vnodes. 351 */ 352int |
270ffs_reload(mountp, cred, p) 271 register struct mount *mountp; | 353ffs_reload(mp, cred, p) 354 register struct mount *mp; |
272 struct ucred *cred; 273 struct proc *p; 274{ 275 register struct vnode *vp, *nvp, *devvp; 276 struct inode *ip; 277 struct csum *space; 278 struct buf *bp; 279 struct fs *fs; 280 int i, blks, size, error; 281 | 355 struct ucred *cred; 356 struct proc *p; 357{ 358 register struct vnode *vp, *nvp, *devvp; 359 struct inode *ip; 360 struct csum *space; 361 struct buf *bp; 362 struct fs *fs; 363 int i, blks, size, error; 364 |
282 if ((mountp->mnt_flag & MNT_RDONLY) == 0) | 365 if ((mp->mnt_flag & MNT_RDONLY) == 0) |
283 return (EINVAL); 284 /* 285 * Step 1: invalidate all cached meta-data. 286 */ | 366 return (EINVAL); 367 /* 368 * Step 1: invalidate all cached meta-data. 369 */ |
287 devvp = VFSTOUFS(mountp)->um_devvp; | 370 devvp = VFSTOUFS(mp)->um_devvp; |
288 if (vinvalbuf(devvp, 0, cred, p, 0, 0)) 289 panic("ffs_reload: dirty1"); 290 /* 291 * Step 2: re-read superblock from disk. 292 */ 293 error = bread(devvp, SBLOCK, SBSIZE, NOCRED, &bp); 294 if (error) 295 return (error); 296 fs = (struct fs *)bp->b_data; 297 if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE || 298 fs->fs_bsize < sizeof(struct fs)) { 299 brelse(bp); 300 return (EIO); /* XXX needs translation */ 301 } | 371 if (vinvalbuf(devvp, 0, cred, p, 0, 0)) 372 panic("ffs_reload: dirty1"); 373 /* 374 * Step 2: re-read superblock from disk. 375 */ 376 error = bread(devvp, SBLOCK, SBSIZE, NOCRED, &bp); 377 if (error) 378 return (error); 379 fs = (struct fs *)bp->b_data; 380 if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE || 381 fs->fs_bsize < sizeof(struct fs)) { 382 brelse(bp); 383 return (EIO); /* XXX needs translation */ 384 } |
302 fs = VFSTOUFS(mountp)->um_fs; | 385 fs = VFSTOUFS(mp)->um_fs; |
303 bcopy(&fs->fs_csp[0], &((struct fs *)bp->b_data)->fs_csp[0], 304 sizeof(fs->fs_csp)); 305 bcopy(bp->b_data, fs, (u_int)fs->fs_sbsize); 306 if (fs->fs_sbsize < SBSIZE) 307 bp->b_flags |= B_INVAL; 308 brelse(bp); 309 ffs_oldfscompat(fs); 310 ffs_vmlimits(fs); --- 9 unchanged lines hidden (view full) --- 320 error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size, 321 NOCRED, &bp); 322 if (error) 323 return (error); 324 bcopy(bp->b_data, fs->fs_csp[fragstoblks(fs, i)], (u_int)size); 325 brelse(bp); 326 } 327loop: | 386 bcopy(&fs->fs_csp[0], &((struct fs *)bp->b_data)->fs_csp[0], 387 sizeof(fs->fs_csp)); 388 bcopy(bp->b_data, fs, (u_int)fs->fs_sbsize); 389 if (fs->fs_sbsize < SBSIZE) 390 bp->b_flags |= B_INVAL; 391 brelse(bp); 392 ffs_oldfscompat(fs); 393 ffs_vmlimits(fs); --- 9 unchanged lines hidden (view full) --- 403 error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size, 404 NOCRED, &bp); 405 if (error) 406 return (error); 407 bcopy(bp->b_data, fs->fs_csp[fragstoblks(fs, i)], (u_int)size); 408 brelse(bp); 409 } 410loop: |
328 for (vp = mountp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) { | 411 for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) { |
329 nvp = vp->v_mntvnodes.le_next; 330 /* 331 * Step 4: invalidate all inactive vnodes. 332 */ 333 if (vp->v_usecount == 0) { 334 vgone(vp); 335 continue; 336 } --- 14 unchanged lines hidden (view full) --- 351 if (error) { 352 vput(vp); 353 return (error); 354 } 355 ip->i_din = *((struct dinode *)bp->b_data + 356 ino_to_fsbo(fs, ip->i_number)); 357 brelse(bp); 358 vput(vp); | 412 nvp = vp->v_mntvnodes.le_next; 413 /* 414 * Step 4: invalidate all inactive vnodes. 415 */ 416 if (vp->v_usecount == 0) { 417 vgone(vp); 418 continue; 419 } --- 14 unchanged lines hidden (view full) --- 434 if (error) { 435 vput(vp); 436 return (error); 437 } 438 ip->i_din = *((struct dinode *)bp->b_data + 439 ino_to_fsbo(fs, ip->i_number)); 440 brelse(bp); 441 vput(vp); |
359 if (vp->v_mount != mountp) | 442 if (vp->v_mount != mp) |
360 goto loop; 361 } 362 return (0); 363} 364 365/* 366 * Common code for mount and mountroot 367 */ --- 7 unchanged lines hidden (view full) --- 375 struct buf *bp; 376 register struct fs *fs; 377 dev_t dev = devvp->v_rdev; 378 struct partinfo dpart; 379 caddr_t base, space; 380 int havepart = 0, blks; 381 int error, i, size; 382 int ronly; | 443 goto loop; 444 } 445 return (0); 446} 447 448/* 449 * Common code for mount and mountroot 450 */ --- 7 unchanged lines hidden (view full) --- 458 struct buf *bp; 459 register struct fs *fs; 460 dev_t dev = devvp->v_rdev; 461 struct partinfo dpart; 462 caddr_t base, space; 463 int havepart = 0, blks; 464 int error, i, size; 465 int ronly; |
466 u_int strsize; |
|
383 384 /* 385 * Disallow multiple mounts of the same device. 386 * Disallow mounting of a device that is currently in use 387 * (except for root, which might share swap device for miniroot). 388 * Flush out any old buffers remaining from a previous use. 389 */ 390 error = vfs_mountedon(devvp); --- 81 unchanged lines hidden (view full) --- 472 ump->um_nindir = fs->fs_nindir; 473 ump->um_bptrtodb = fs->fs_fsbtodb; 474 ump->um_seqinc = fs->fs_frag; 475 for (i = 0; i < MAXQUOTAS; i++) 476 ump->um_quotas[i] = NULLVP; 477 devvp->v_specflags |= SI_MOUNTEDON; 478 ffs_oldfscompat(fs); 479 ffs_vmlimits(fs); | 467 468 /* 469 * Disallow multiple mounts of the same device. 470 * Disallow mounting of a device that is currently in use 471 * (except for root, which might share swap device for miniroot). 472 * Flush out any old buffers remaining from a previous use. 473 */ 474 error = vfs_mountedon(devvp); --- 81 unchanged lines hidden (view full) --- 556 ump->um_nindir = fs->fs_nindir; 557 ump->um_bptrtodb = fs->fs_fsbtodb; 558 ump->um_seqinc = fs->fs_frag; 559 for (i = 0; i < MAXQUOTAS; i++) 560 ump->um_quotas[i] = NULLVP; 561 devvp->v_specflags |= SI_MOUNTEDON; 562 ffs_oldfscompat(fs); 563 ffs_vmlimits(fs); |
564 565 /* 566 * Set FS local "last mounted on" information (NULL pad) 567 */ 568 copystr( mp->mnt_stat.f_mntonname, /* mount point*/ 569 fs->fs_fsmnt, /* copy area*/ 570 sizeof(fs->fs_fsmnt) - 1, /* max size*/ 571 &strsize); /* real size*/ 572 bzero( fs->fs_fsmnt + strsize, sizeof(fs->fs_fsmnt) - strsize); 573 574 if( mp->mnt_flag & MNT_ROOTFS) { 575 /* 576 * Root mount; update timestamp in mount structure. 577 * this will be used by the common root mount code 578 * to update the system clock. 579 */ 580 mp->mnt_time = fs->fs_time; 581 } |
|
480 if (ronly == 0) 481 ffs_sbupdate(ump, MNT_WAIT); 482 return (0); 483out: 484 if (bp) 485 brelse(bp); 486 (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); 487 if (ump) { --- 466 unchanged lines hidden --- | 582 if (ronly == 0) 583 ffs_sbupdate(ump, MNT_WAIT); 584 return (0); 585out: 586 if (bp) 587 brelse(bp); 588 (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); 589 if (ump) { --- 466 unchanged lines hidden --- |