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_swapexthifive-unleashed-5.1
commit
b987e8e5a9
|
@ -371,7 +371,11 @@ xfs_quiesce_attr(
|
||||||
/* flush inodes and push all remaining buffers out to disk */
|
/* flush inodes and push all remaining buffers out to disk */
|
||||||
xfs_quiesce_fs(mp);
|
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 */
|
/* Push the superblock and write an unmount record */
|
||||||
error = xfs_log_sbcount(mp, 1);
|
error = xfs_log_sbcount(mp, 1);
|
||||||
|
|
|
@ -55,17 +55,11 @@ xfs_swapext(
|
||||||
struct file *file, *target_file;
|
struct file *file, *target_file;
|
||||||
int error = 0;
|
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 */
|
/* Pull information for the target fd */
|
||||||
file = fget((int)sxp->sx_fdtarget);
|
file = fget((int)sxp->sx_fdtarget);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
error = XFS_ERROR(EINVAL);
|
error = XFS_ERROR(EINVAL);
|
||||||
goto out_free_sxp;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) {
|
if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) {
|
||||||
|
@ -109,8 +103,6 @@ xfs_swapext(
|
||||||
fput(target_file);
|
fput(target_file);
|
||||||
out_put_file:
|
out_put_file:
|
||||||
fput(file);
|
fput(file);
|
||||||
out_free_sxp:
|
|
||||||
kmem_free(sxp);
|
|
||||||
out:
|
out:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,16 +70,21 @@ STATIC void xlog_recover_check_summary(xlog_t *);
|
||||||
xfs_buf_t *
|
xfs_buf_t *
|
||||||
xlog_get_bp(
|
xlog_get_bp(
|
||||||
xlog_t *log,
|
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 (log->l_sectbb_log) {
|
||||||
if (num_bblks > 1)
|
if (nbblks > 1)
|
||||||
num_bblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
|
nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
|
||||||
num_bblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, num_bblks);
|
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
|
void
|
||||||
|
@ -102,6 +107,13 @@ xlog_bread(
|
||||||
{
|
{
|
||||||
int error;
|
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) {
|
if (log->l_sectbb_log) {
|
||||||
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
|
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
|
||||||
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
|
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
|
||||||
|
@ -139,6 +151,13 @@ xlog_bwrite(
|
||||||
{
|
{
|
||||||
int error;
|
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) {
|
if (log->l_sectbb_log) {
|
||||||
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
|
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
|
||||||
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
|
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
|
||||||
|
|
Loading…
Reference in New Issue