Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  [XFS] Warn on transaction in flight on read-only remount
  xfs: Check buffer lengths in log recovery
  don't reallocate sxp variable passed into xfs_swapext
This commit is contained in:
Linus Torvalds 2009-02-03 16:49:54 -08:00
commit b987e8e5a9
3 changed files with 31 additions and 16 deletions

View File

@ -371,7 +371,11 @@ xfs_quiesce_attr(
/* flush inodes and push all remaining buffers out to disk */
xfs_quiesce_fs(mp);
ASSERT_ALWAYS(atomic_read(&mp->m_active_trans) == 0);
/*
* Just warn here till VFS can correctly support
* read-only remount without racing.
*/
WARN_ON(atomic_read(&mp->m_active_trans) != 0);
/* Push the superblock and write an unmount record */
error = xfs_log_sbcount(mp, 1);

View File

@ -55,17 +55,11 @@ xfs_swapext(
struct file *file, *target_file;
int error = 0;
sxp = kmem_alloc(sizeof(xfs_swapext_t), KM_MAYFAIL);
if (!sxp) {
error = XFS_ERROR(ENOMEM);
goto out;
}
/* Pull information for the target fd */
file = fget((int)sxp->sx_fdtarget);
if (!file) {
error = XFS_ERROR(EINVAL);
goto out_free_sxp;
goto out;
}
if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) {
@ -109,8 +103,6 @@ xfs_swapext(
fput(target_file);
out_put_file:
fput(file);
out_free_sxp:
kmem_free(sxp);
out:
return error;
}

View File

@ -70,16 +70,21 @@ STATIC void xlog_recover_check_summary(xlog_t *);
xfs_buf_t *
xlog_get_bp(
xlog_t *log,
int num_bblks)
int nbblks)
{
ASSERT(num_bblks > 0);
if (nbblks <= 0 || nbblks > log->l_logBBsize) {
xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
XFS_ERROR_REPORT("xlog_get_bp(1)",
XFS_ERRLEVEL_HIGH, log->l_mp);
return NULL;
}
if (log->l_sectbb_log) {
if (num_bblks > 1)
num_bblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
num_bblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, num_bblks);
if (nbblks > 1)
nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
}
return xfs_buf_get_noaddr(BBTOB(num_bblks), log->l_mp->m_logdev_targp);
return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp);
}
void
@ -102,6 +107,13 @@ xlog_bread(
{
int error;
if (nbblks <= 0 || nbblks > log->l_logBBsize) {
xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
XFS_ERROR_REPORT("xlog_bread(1)",
XFS_ERRLEVEL_HIGH, log->l_mp);
return EFSCORRUPTED;
}
if (log->l_sectbb_log) {
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
@ -139,6 +151,13 @@ xlog_bwrite(
{
int error;
if (nbblks <= 0 || nbblks > log->l_logBBsize) {
xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
XFS_ERROR_REPORT("xlog_bwrite(1)",
XFS_ERRLEVEL_HIGH, log->l_mp);
return EFSCORRUPTED;
}
if (log->l_sectbb_log) {
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);