]> git.neil.brown.name Git - history.git/commitdiff
[XFS] Prevent a couple transactions from happening on ro mounts
authorEric Sandeen <sandeen@sgi.com>
Wed, 6 Nov 2002 21:35:03 +0000 (22:35 +0100)
committerNathan Scott <nathans@sgi.com>
Wed, 6 Nov 2002 21:35:03 +0000 (22:35 +0100)
SGI Modid: 2.5.x-xfs:slinx:131187a

fs/xfs/xfs_log.c
fs/xfs/xfs_vnodeops.c

index d156b9cb7a7f7184fabf3756ef5e0b8f5df16a6f..343d7cbc1d1d133eb33857adfd2e1f8ba6e52bd9 100644 (file)
@@ -480,9 +480,17 @@ xfs_log_mount(xfs_mount_t  *mp,
         * just worked.
         */
        if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) {
-               int    error;
+               int     error;
+               vfs_t   *vfsp = XFS_MTOVFS(mp);
+               int     readonly = (vfsp->vfs_flag & VFS_RDONLY);
 
-               error = xlog_recover(log,XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY);
+               if (readonly)
+                       vfsp->vfs_flag &= ~VFS_RDONLY;
+
+               error = xlog_recover(log, readonly);
+
+               if (readonly)
+                       vfsp->vfs_flag |= VFS_RDONLY;
                if (error) {
                        cmn_err(CE_WARN, "XFS: log mount/recovery failed");
                        xlog_unalloc_log(log);
index 4e6cbe32c0579bee1d631c56447e757c29bc32bb..e60f12e1b2296976221d8ab7751d66ca4d6b9b8f 100644 (file)
@@ -1625,6 +1625,10 @@ xfs_release(
                return 0;
        }
 
+       /* If this is a read-only mount, don't do this (would generate I/O) */
+       if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
+               return 0;
+
        mp = ip->i_mount;
 
        if (ip->i_d.di_nlink != 0) {
@@ -1700,6 +1704,11 @@ xfs_inactive(
        }
 
        error = 0;
+
+       /* If this is a read-only mount, don't do this (would generate I/O) */
+       if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
+               goto out;
+
        if (ip->i_d.di_nlink != 0) {
                if ((((ip->i_d.di_mode & IFMT) == IFREG) &&
                     ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0)) &&