Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
Browse files Browse the repository at this point in the history
* '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
  • Loading branch information
Linus Torvalds committed Feb 4, 2009
2 parents 52a84ec + 43f3f05 commit b987e8e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
6 changes: 5 additions & 1 deletion fs/xfs/linux-2.6/xfs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 1 addition & 9 deletions fs/xfs/xfs_dfrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -109,8 +103,6 @@ xfs_swapext(
fput(target_file);
out_put_file:
fput(file);
out_free_sxp:
kmem_free(sxp);
out:
return error;
}
Expand Down
31 changes: 25 additions & 6 deletions fs/xfs/xfs_log_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b987e8e

Please sign in to comment.