Commit 89c4520e authored by Russell Cattelan's avatar Russell Cattelan Committed by Christoph Hellwig

[XFS] Revisit the remount read only code again.

apparently the root file system are not being synced 
correctly during system shutdown

SGI Modid: 2.5.x-xfs:slinx:136269a
parent 153d182f
......@@ -872,13 +872,12 @@ XFS_log_write_unmount_ro(bhv_desc_t *bdp)
int error;
mp = XFS_BHVTOM(bdp);
xfs_binval(mp->m_ddev_targp);
pagebuf_delwri_flush(mp->m_ddev_targp, PBDF_WAIT, &pincount);
xfs_finish_reclaim_all(mp);
do {
xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
VFS_SYNC(XFS_MTOVFS(mp), SYNC_ATTR|SYNC_WAIT, NULL, error);
pagebuf_delwri_flush(mp->m_ddev_targp,
PBDF_WAIT, &pincount);
pagebuf_delwri_flush(mp->m_ddev_targp, PBDF_WAIT, &pincount);
if (pincount == 0) {delay(50); count++;}
} while (count < 2);
......
......@@ -481,6 +481,7 @@ void xfs_iunlock_map_shared(xfs_inode_t *, uint);
void xfs_ifunlock(xfs_inode_t *);
void xfs_ireclaim(xfs_inode_t *);
int xfs_finish_reclaim(xfs_inode_t *, int, int);
int xfs_reclaim_all(struct xfs_mount *);
/*
* xfs_inode.c prototypes.
......
......@@ -82,7 +82,7 @@ xfs_open(
/*
* xfs_getattr
*/
STATIC int
int
xfs_getattr(
bhv_desc_t *bdp,
vattr_t *vap,
......@@ -4060,6 +4060,49 @@ xfs_finish_reclaim(
return 0;
}
int
xfs_finish_reclaim_all(xfs_mount_t *mp)
{
int purged;
xfs_inode_t *ip;
vnode_t *vp;
int done = 0;
while (!done) {
purged = 0;
XFS_MOUNT_ILOCK(mp);
ip = mp->m_inodes;
if (ip == NULL) {
break;
}
do {
/* Make sure we skip markers inserted by sync */
if (ip->i_mount == NULL) {
ip = ip->i_mnext;
continue;
}
/*
* It's up to our caller to purge the root
* and quota vnodes later.
*/
vp = XFS_ITOV_NULL(ip);
if (!vp) {
XFS_MOUNT_IUNLOCK(mp);
xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC);
purged = 1;
break;
}
} while (ip != mp->m_inodes);
done = !purged;
}
XFS_MOUNT_IUNLOCK(mp);
return 0;
}
/*
* xfs_alloc_file_space()
* This routine allocates disk space for the given file.
......
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