提交 78efd1dd 编写于 作者: L Linus Torvalds

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

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  xfs: fix spin_is_locked assert on uni-processor builds
  xfs: check for dinode realtime flag corruption
  use XFS_CORRUPTION_ERROR in xfs_btree_check_sblock
  xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_get
  xfs: switch to NOFS allocation under i_lock in xfs_readlink_bmap
  xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_set
  xfs: switch to NOFS allocation under i_lock in xfs_buf_associate_memory
  xfs: switch to NOFS allocation under i_lock in xfs_dir_cilookup_result
  xfs: switch to NOFS allocation under i_lock in xfs_da_buf_make
  xfs: switch to NOFS allocation under i_lock in xfs_da_state_alloc
  xfs: switch to NOFS allocation under i_lock in xfs_getbmap
  xfs: avoid memory allocation under m_peraglock in growfs code
...@@ -770,7 +770,7 @@ xfs_buf_associate_memory( ...@@ -770,7 +770,7 @@ xfs_buf_associate_memory(
bp->b_pages = NULL; bp->b_pages = NULL;
bp->b_addr = mem; bp->b_addr = mem;
rval = _xfs_buf_get_pages(bp, page_count, 0); rval = _xfs_buf_get_pages(bp, page_count, XBF_DONT_BLOCK);
if (rval) if (rval)
return rval; return rval;
......
...@@ -2010,7 +2010,9 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) ...@@ -2010,7 +2010,9 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock); dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock);
blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount); blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount);
error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno, error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno,
blkcnt, XFS_BUF_LOCK, &bp); blkcnt,
XFS_BUF_LOCK | XBF_DONT_BLOCK,
&bp);
if (error) if (error)
return(error); return(error);
...@@ -2141,8 +2143,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) ...@@ -2141,8 +2143,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock), dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock),
blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount); blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount);
bp = xfs_buf_get_flags(mp->m_ddev_targp, dblkno, bp = xfs_buf_get_flags(mp->m_ddev_targp, dblkno, blkcnt,
blkcnt, XFS_BUF_LOCK); XFS_BUF_LOCK | XBF_DONT_BLOCK);
ASSERT(bp); ASSERT(bp);
ASSERT(!XFS_BUF_GETERROR(bp)); ASSERT(!XFS_BUF_GETERROR(bp));
......
...@@ -6009,7 +6009,7 @@ xfs_getbmap( ...@@ -6009,7 +6009,7 @@ xfs_getbmap(
*/ */
error = ENOMEM; error = ENOMEM;
subnex = 16; subnex = 16;
map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL); map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL | KM_NOFS);
if (!map) if (!map)
goto out_unlock_ilock; goto out_unlock_ilock;
......
...@@ -120,8 +120,8 @@ xfs_btree_check_sblock( ...@@ -120,8 +120,8 @@ xfs_btree_check_sblock(
XFS_RANDOM_BTREE_CHECK_SBLOCK))) { XFS_RANDOM_BTREE_CHECK_SBLOCK))) {
if (bp) if (bp)
xfs_buftrace("SBTREE ERROR", bp); xfs_buftrace("SBTREE ERROR", bp);
XFS_ERROR_REPORT("xfs_btree_check_sblock", XFS_ERRLEVEL_LOW, XFS_CORRUPTION_ERROR("xfs_btree_check_sblock",
cur->bc_mp); XFS_ERRLEVEL_LOW, cur->bc_mp, block);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
return 0; return 0;
......
...@@ -2201,7 +2201,7 @@ kmem_zone_t *xfs_dabuf_zone; /* dabuf zone */ ...@@ -2201,7 +2201,7 @@ kmem_zone_t *xfs_dabuf_zone; /* dabuf zone */
xfs_da_state_t * xfs_da_state_t *
xfs_da_state_alloc(void) xfs_da_state_alloc(void)
{ {
return kmem_zone_zalloc(xfs_da_state_zone, KM_SLEEP); return kmem_zone_zalloc(xfs_da_state_zone, KM_NOFS);
} }
/* /*
...@@ -2261,9 +2261,9 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra) ...@@ -2261,9 +2261,9 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra)
int off; int off;
if (nbuf == 1) if (nbuf == 1)
dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_SLEEP); dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_NOFS);
else else
dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_SLEEP); dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_NOFS);
dabuf->dirty = 0; dabuf->dirty = 0;
#ifdef XFS_DABUF_DEBUG #ifdef XFS_DABUF_DEBUG
dabuf->ra = ra; dabuf->ra = ra;
......
...@@ -256,7 +256,7 @@ xfs_dir_cilookup_result( ...@@ -256,7 +256,7 @@ xfs_dir_cilookup_result(
!(args->op_flags & XFS_DA_OP_CILOOKUP)) !(args->op_flags & XFS_DA_OP_CILOOKUP))
return EEXIST; return EEXIST;
args->value = kmem_alloc(len, KM_MAYFAIL); args->value = kmem_alloc(len, KM_NOFS | KM_MAYFAIL);
if (!args->value) if (!args->value)
return ENOMEM; return ENOMEM;
......
...@@ -167,17 +167,25 @@ xfs_growfs_data_private( ...@@ -167,17 +167,25 @@ xfs_growfs_data_private(
new = nb - mp->m_sb.sb_dblocks; new = nb - mp->m_sb.sb_dblocks;
oagcount = mp->m_sb.sb_agcount; oagcount = mp->m_sb.sb_agcount;
if (nagcount > oagcount) { if (nagcount > oagcount) {
void *new_perag, *old_perag;
xfs_filestream_flush(mp); xfs_filestream_flush(mp);
new_perag = kmem_zalloc(sizeof(xfs_perag_t) * nagcount,
KM_MAYFAIL);
if (!new_perag)
return XFS_ERROR(ENOMEM);
down_write(&mp->m_peraglock); down_write(&mp->m_peraglock);
mp->m_perag = kmem_realloc(mp->m_perag, memcpy(new_perag, mp->m_perag, sizeof(xfs_perag_t) * oagcount);
sizeof(xfs_perag_t) * nagcount, old_perag = mp->m_perag;
sizeof(xfs_perag_t) * oagcount, mp->m_perag = new_perag;
KM_SLEEP);
memset(&mp->m_perag[oagcount], 0,
(nagcount - oagcount) * sizeof(xfs_perag_t));
mp->m_flags |= XFS_MOUNT_32BITINODES; mp->m_flags |= XFS_MOUNT_32BITINODES;
nagimax = xfs_initialize_perag(mp, nagcount); nagimax = xfs_initialize_perag(mp, nagcount);
up_write(&mp->m_peraglock); up_write(&mp->m_peraglock);
kmem_free(old_perag);
} }
tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS); tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS);
tp->t_flags |= XFS_TRANS_RESERVE; tp->t_flags |= XFS_TRANS_RESERVE;
......
...@@ -343,6 +343,16 @@ xfs_iformat( ...@@ -343,6 +343,16 @@ xfs_iformat(
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) &&
!ip->i_mount->m_rtdev_targp)) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
"corrupt dinode %Lu, has realtime flag set.",
ip->i_ino);
XFS_CORRUPTION_ERROR("xfs_iformat(realtime)",
XFS_ERRLEVEL_LOW, ip->i_mount, dip);
return XFS_ERROR(EFSCORRUPTED);
}
switch (ip->i_d.di_mode & S_IFMT) { switch (ip->i_d.di_mode & S_IFMT) {
case S_IFIFO: case S_IFIFO:
case S_IFCHR: case S_IFCHR:
......
...@@ -3180,7 +3180,7 @@ xlog_state_sync(xlog_t *log, ...@@ -3180,7 +3180,7 @@ xlog_state_sync(xlog_t *log,
STATIC void STATIC void
xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog) xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog)
{ {
ASSERT(spin_is_locked(&log->l_icloglock)); assert_spin_locked(&log->l_icloglock);
if (iclog->ic_state == XLOG_STATE_ACTIVE) { if (iclog->ic_state == XLOG_STATE_ACTIVE) {
xlog_state_switch_iclogs(log, iclog, 0); xlog_state_switch_iclogs(log, iclog, 0);
......
...@@ -538,7 +538,9 @@ xfs_readlink_bmap( ...@@ -538,7 +538,9 @@ xfs_readlink_bmap(
d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock); d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock);
byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0); bp = xfs_buf_read_flags(mp->m_ddev_targp, d, BTOBB(byte_cnt),
XBF_LOCK | XBF_MAPPED |
XBF_DONT_BLOCK);
error = XFS_BUF_GETERROR(bp); error = XFS_BUF_GETERROR(bp);
if (error) { if (error) {
xfs_ioerror_alert("xfs_readlink", xfs_ioerror_alert("xfs_readlink",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册