Commit 93c01a6f authored by Eric Sandeen's avatar Eric Sandeen Committed by Nathan Scott

[XFS] Prevent a couple transactions from happening on ro mounts

SGI Modid: 2.5.x-xfs:slinx:131187a
parent fd12985b
...@@ -480,9 +480,17 @@ xfs_log_mount(xfs_mount_t *mp, ...@@ -480,9 +480,17 @@ xfs_log_mount(xfs_mount_t *mp,
* just worked. * just worked.
*/ */
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) { 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) { if (error) {
cmn_err(CE_WARN, "XFS: log mount/recovery failed"); cmn_err(CE_WARN, "XFS: log mount/recovery failed");
xlog_unalloc_log(log); xlog_unalloc_log(log);
......
...@@ -1625,6 +1625,10 @@ xfs_release( ...@@ -1625,6 +1625,10 @@ xfs_release(
return 0; 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; mp = ip->i_mount;
if (ip->i_d.di_nlink != 0) { if (ip->i_d.di_nlink != 0) {
...@@ -1700,6 +1704,11 @@ xfs_inactive( ...@@ -1700,6 +1704,11 @@ xfs_inactive(
} }
error = 0; 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_nlink != 0) {
if ((((ip->i_d.di_mode & IFMT) == IFREG) && if ((((ip->i_d.di_mode & IFMT) == IFREG) &&
((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0)) && ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0)) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment