-#ifdef NOTLFS /* LFS */
- fs = ump->um_fs;
- if (fs->fs_ronly && (mp->mnt_flag & MNT_RDONLY) == 0)
- fs->fs_ronly = 0;
-#else
- fs = ump->um_lfs;
- if (fs->lfs_ronly && (mp->mnt_flag & MNT_RDONLY) == 0)
+ if (fs->lfs_ronly && (mp->mnt_flag & MNT_WANTRDWR)) {
+ /*
+ * If upgrade to read-write by non-root, then verify
+ * that user has necessary permissions on the device.
+ */
+ if (p->p_ucred->cr_uid != 0) {
+ VOP_LOCK(ump->um_devvp);
+ if (error = VOP_ACCESS(ump->um_devvp,
+ VREAD | VWRITE, p->p_ucred, p)) {
+ VOP_UNLOCK(ump->um_devvp);
+ return (error);
+ }
+ VOP_UNLOCK(ump->um_devvp);
+ }