Merge branch 'xfs-misc-fixes-for-4.3' into for-next

This commit is contained in:
Dave Chinner 2015-07-29 11:54:07 +10:00
commit 20b8394436
13 changed files with 98 additions and 74 deletions

View file

@ -33,6 +33,7 @@ xfs-y += $(addprefix libxfs/, \
xfs_attr.o \ xfs_attr.o \
xfs_attr_leaf.o \ xfs_attr_leaf.o \
xfs_attr_remote.o \ xfs_attr_remote.o \
xfs_bit.o \
xfs_bmap.o \ xfs_bmap.o \
xfs_bmap_btree.o \ xfs_bmap_btree.o \
xfs_btree.o \ xfs_btree.o \
@ -63,7 +64,6 @@ xfs-$(CONFIG_XFS_RT) += $(addprefix libxfs/, \
xfs-y += xfs_aops.o \ xfs-y += xfs_aops.o \
xfs_attr_inactive.o \ xfs_attr_inactive.o \
xfs_attr_list.o \ xfs_attr_list.o \
xfs_bit.o \
xfs_bmap_util.o \ xfs_bmap_util.o \
xfs_buf.o \ xfs_buf.o \
xfs_dir2_readdir.o \ xfs_dir2_readdir.o \

View file

@ -618,9 +618,8 @@ xfs_attr_rmtval_remove(
xfs_bmap_init(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, XFS_BMAPI_ATTRFORK, 1, args->firstblock,
1, args->firstblock, args->flist, args->flist, &done);
&done);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, args->flist, error = xfs_bmap_finish(&args->trans, args->flist,
&committed); &committed);

View file

@ -2351,8 +2351,8 @@ xfs_da_shrink_inode(
* the last block to the place we want to kill. * the last block to the place we want to kill.
*/ */
error = xfs_bunmapi(tp, dp, dead_blkno, count, error = xfs_bunmapi(tp, dp, dead_blkno, count,
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA, xfs_bmapi_aflag(w), 0, args->firstblock,
0, args->firstblock, args->flist, &done); args->flist, &done);
if (error == -ENOSPC) { if (error == -ENOSPC) {
if (w != XFS_DATA_FORK) if (w != XFS_DATA_FORK)
break; break;

View file

@ -674,25 +674,22 @@ xfs_dir2_shrink_inode(
mp = dp->i_mount; mp = dp->i_mount;
tp = args->trans; tp = args->trans;
da = xfs_dir2_db_to_da(args->geo, db); da = xfs_dir2_db_to_da(args->geo, db);
/*
* Unmap the fsblock(s). /* Unmap the fsblock(s). */
*/ error = xfs_bunmapi(tp, dp, da, args->geo->fsbcount, 0, 0,
if ((error = xfs_bunmapi(tp, dp, da, args->geo->fsbcount, args->firstblock, args->flist, &done);
XFS_BMAPI_METADATA, 0, args->firstblock, args->flist, if (error) {
&done))) {
/* /*
* ENOSPC actually can happen if we're in a removename with * ENOSPC actually can happen if we're in a removename with no
* no space reservation, and the resulting block removal * space reservation, and the resulting block removal would
* would cause a bmap btree split or conversion from extents * cause a bmap btree split or conversion from extents to btree.
* to btree. This can only happen for un-fragmented * This can only happen for un-fragmented directory blocks,
* directory blocks, since you need to be punching out * since you need to be punching out the middle of an extent.
* the middle of an extent. * In this case we need to leave the block in the file, and not
* In this case we need to leave the block in the file, * binval it. So the block has to be in a consistent empty
* and not binval it. * state and appropriately logged. We don't free up the buffer,
* So the block has to be in a consistent empty state * the caller can tell it hasn't happened since it got an error
* and appropriately logged. * back.
* We don't free up the buffer, the caller can tell it
* hasn't happened since it got an error back.
*/ */
return error; return error;
} }

View file

@ -1845,8 +1845,7 @@ xfs_dir2_node_addname_int(
if (dp->d_ops->db_to_fdb(args->geo, dbno) != fbno) { if (dp->d_ops->db_to_fdb(args->geo, dbno) != fbno) {
xfs_alert(mp, xfs_alert(mp,
"%s: dir ino %llu needed freesp block %lld for\n" "%s: dir ino %llu needed freesp block %lld for data block %lld, got %lld ifbno %llu lastfbno %d",
" data block %lld, got %lld ifbno %llu lastfbno %d",
__func__, (unsigned long long)dp->i_ino, __func__, (unsigned long long)dp->i_ino,
(long long)dp->d_ops->db_to_fdb( (long long)dp->d_ops->db_to_fdb(
args->geo, dbno), args->geo, dbno),

View file

@ -131,10 +131,11 @@ xfs_mount_validate_sb(
if (xfs_sb_has_compat_feature(sbp, if (xfs_sb_has_compat_feature(sbp,
XFS_SB_FEAT_COMPAT_UNKNOWN)) { XFS_SB_FEAT_COMPAT_UNKNOWN)) {
xfs_warn(mp, xfs_warn(mp,
"Superblock has unknown compatible features (0x%x) enabled.\n" "Superblock has unknown compatible features (0x%x) enabled.",
"Using a more recent kernel is recommended.",
(sbp->sb_features_compat & (sbp->sb_features_compat &
XFS_SB_FEAT_COMPAT_UNKNOWN)); XFS_SB_FEAT_COMPAT_UNKNOWN));
xfs_warn(mp,
"Using a more recent kernel is recommended.");
} }
if (xfs_sb_has_ro_compat_feature(sbp, if (xfs_sb_has_ro_compat_feature(sbp,
@ -145,18 +146,21 @@ xfs_mount_validate_sb(
XFS_SB_FEAT_RO_COMPAT_UNKNOWN)); XFS_SB_FEAT_RO_COMPAT_UNKNOWN));
if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
xfs_warn(mp, xfs_warn(mp,
"Attempted to mount read-only compatible filesystem read-write.\n" "Attempted to mount read-only compatible filesystem read-write.");
xfs_warn(mp,
"Filesystem can only be safely mounted read only."); "Filesystem can only be safely mounted read only.");
return -EINVAL; return -EINVAL;
} }
} }
if (xfs_sb_has_incompat_feature(sbp, if (xfs_sb_has_incompat_feature(sbp,
XFS_SB_FEAT_INCOMPAT_UNKNOWN)) { XFS_SB_FEAT_INCOMPAT_UNKNOWN)) {
xfs_warn(mp, xfs_warn(mp,
"Superblock has unknown incompatible features (0x%x) enabled.\n" "Superblock has unknown incompatible features (0x%x) enabled.",
"Filesystem can not be safely mounted by this kernel.",
(sbp->sb_features_incompat & (sbp->sb_features_incompat &
XFS_SB_FEAT_INCOMPAT_UNKNOWN)); XFS_SB_FEAT_INCOMPAT_UNKNOWN));
xfs_warn(mp,
"Filesystem can not be safely mounted by this kernel.");
return -EINVAL; return -EINVAL;
} }
} }

View file

@ -1533,9 +1533,10 @@ xfs_wait_buftarg(
list_del_init(&bp->b_lru); list_del_init(&bp->b_lru);
if (bp->b_flags & XBF_WRITE_FAIL) { if (bp->b_flags & XBF_WRITE_FAIL) {
xfs_alert(btp->bt_mount, xfs_alert(btp->bt_mount,
"Corruption Alert: Buffer at block 0x%llx had permanent write failures!\n" "Corruption Alert: Buffer at block 0x%llx had permanent write failures!",
"Please run xfs_repair to determine the extent of the problem.",
(long long)bp->b_bn); (long long)bp->b_bn);
xfs_alert(btp->bt_mount,
"Please run xfs_repair to determine the extent of the problem.");
} }
xfs_buf_rele(bp); xfs_buf_rele(bp);
} }

View file

@ -1175,11 +1175,8 @@ xfs_create(
*/ */
error = xfs_dir_ialloc(&tp, dp, mode, is_dir ? 2 : 1, rdev, error = xfs_dir_ialloc(&tp, dp, mode, is_dir ? 2 : 1, rdev,
prid, resblks > 0, &ip, &committed); prid, resblks > 0, &ip, &committed);
if (error) { if (error)
if (error == -ENOSPC)
goto out_trans_cancel;
goto out_trans_cancel; goto out_trans_cancel;
}
/* /*
* Now we join the directory inode to the transaction. We do not do it * Now we join the directory inode to the transaction. We do not do it
@ -1318,11 +1315,8 @@ xfs_create_tmpfile(
error = xfs_dir_ialloc(&tp, dp, mode, 1, 0, error = xfs_dir_ialloc(&tp, dp, mode, 1, 0,
prid, resblks > 0, &ip, NULL); prid, resblks > 0, &ip, NULL);
if (error) { if (error)
if (error == -ENOSPC)
goto out_trans_cancel;
goto out_trans_cancel; goto out_trans_cancel;
}
if (mp->m_flags & XFS_MOUNT_WSYNC) if (mp->m_flags & XFS_MOUNT_WSYNC)
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);

View file

@ -668,9 +668,9 @@ xfs_log_mount(
ASSERT(0); ASSERT(0);
goto out_free_log; goto out_free_log;
} }
xfs_crit(mp, "Log size out of supported range.");
xfs_crit(mp, xfs_crit(mp,
"Log size out of supported range. Continuing onwards, but if log hangs are\n" "Continuing onwards, but if log hangs are experienced then please report this message in the bug report.");
"experienced then please report this message in the bug report.");
} }
/* /*
@ -1142,11 +1142,13 @@ xlog_space_left(
* In this case we just want to return the size of the * In this case we just want to return the size of the
* log as the amount of space left. * log as the amount of space left.
*/ */
xfs_alert(log->l_mp, "xlog_space_left: head behind tail");
xfs_alert(log->l_mp, xfs_alert(log->l_mp,
"xlog_space_left: head behind tail\n" " tail_cycle = %d, tail_bytes = %d",
" tail_cycle = %d, tail_bytes = %d\n" tail_cycle, tail_bytes);
" GH cycle = %d, GH bytes = %d", xfs_alert(log->l_mp,
tail_cycle, tail_bytes, head_cycle, head_bytes); " GH cycle = %d, GH bytes = %d",
head_cycle, head_bytes);
ASSERT(0); ASSERT(0);
free_bytes = log->l_logsize; free_bytes = log->l_logsize;
} }
@ -2028,26 +2030,24 @@ xlog_print_tic_res(
"SWAPEXT" "SWAPEXT"
}; };
xfs_warn(mp, xfs_warn(mp, "xlog_write: reservation summary:");
"xlog_write: reservation summary:\n" xfs_warn(mp, " trans type = %s (%u)",
" trans type = %s (%u)\n" ((ticket->t_trans_type <= 0 ||
" unit res = %d bytes\n" ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ?
" current res = %d bytes\n"
" total reg = %u bytes (o/flow = %u bytes)\n"
" ophdrs = %u (ophdr space = %u bytes)\n"
" ophdr + reg = %u bytes\n"
" num regions = %u",
((ticket->t_trans_type <= 0 ||
ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ?
"bad-trans-type" : trans_type_str[ticket->t_trans_type-1]), "bad-trans-type" : trans_type_str[ticket->t_trans_type-1]),
ticket->t_trans_type, ticket->t_trans_type);
ticket->t_unit_res, xfs_warn(mp, " unit res = %d bytes",
ticket->t_curr_res, ticket->t_unit_res);
ticket->t_res_arr_sum, ticket->t_res_o_flow, xfs_warn(mp, " current res = %d bytes",
ticket->t_res_num_ophdrs, ophdr_spc, ticket->t_curr_res);
ticket->t_res_arr_sum + xfs_warn(mp, " total reg = %u bytes (o/flow = %u bytes)",
ticket->t_res_o_flow + ophdr_spc, ticket->t_res_arr_sum, ticket->t_res_o_flow);
ticket->t_res_num); xfs_warn(mp, " ophdrs = %u (ophdr space = %u bytes)",
ticket->t_res_num_ophdrs, ophdr_spc);
xfs_warn(mp, " ophdr + reg = %u bytes",
ticket->t_res_arr_sum + ticket->t_res_o_flow + ophdr_spc);
xfs_warn(mp, " num regions = %u",
ticket->t_res_num);
for (i = 0; i < ticket->t_res_num; i++) { for (i = 0; i < ticket->t_res_num; i++) {
uint r_type = ticket->t_res_arr[i].r_type; uint r_type = ticket->t_res_arr[i].r_type;

View file

@ -307,7 +307,13 @@ xlog_cil_insert_items(
if (!(lidp->lid_flags & XFS_LID_DIRTY)) if (!(lidp->lid_flags & XFS_LID_DIRTY))
continue; continue;
list_move_tail(&lip->li_cil, &cil->xc_cil); /*
* Only move the item if it isn't already at the tail. This is
* to prevent a transient list_empty() state when reinserting
* an item that is already the only item in the CIL.
*/
if (!list_is_last(&lip->li_cil, &cil->xc_cil))
list_move_tail(&lip->li_cil, &cil->xc_cil);
} }
/* account for space used by new iovec headers */ /* account for space used by new iovec headers */

View file

@ -3385,14 +3385,24 @@ xlog_recover_add_to_cont_trans(
char *ptr, *old_ptr; char *ptr, *old_ptr;
int old_len; int old_len;
/*
* If the transaction is empty, the header was split across this and the
* previous record. Copy the rest of the header.
*/
if (list_empty(&trans->r_itemq)) { if (list_empty(&trans->r_itemq)) {
/* finish copying rest of trans header */ ASSERT(len < sizeof(struct xfs_trans_header));
if (len > sizeof(struct xfs_trans_header)) {
xfs_warn(log->l_mp, "%s: bad header length", __func__);
return -EIO;
}
xlog_recover_add_item(&trans->r_itemq); xlog_recover_add_item(&trans->r_itemq);
ptr = (char *)&trans->r_theader + ptr = (char *)&trans->r_theader +
sizeof(xfs_trans_header_t) - len; sizeof(struct xfs_trans_header) - len;
memcpy(ptr, dp, len); memcpy(ptr, dp, len);
return 0; return 0;
} }
/* take the tail entry */ /* take the tail entry */
item = list_entry(trans->r_itemq.prev, xlog_recover_item_t, ri_list); item = list_entry(trans->r_itemq.prev, xlog_recover_item_t, ri_list);
@ -3441,7 +3451,19 @@ xlog_recover_add_to_trans(
ASSERT(0); ASSERT(0);
return -EIO; return -EIO;
} }
if (len == sizeof(xfs_trans_header_t))
if (len > sizeof(struct xfs_trans_header)) {
xfs_warn(log->l_mp, "%s: bad header length", __func__);
ASSERT(0);
return -EIO;
}
/*
* The transaction header can be arbitrarily split across op
* records. If we don't have the whole thing here, copy what we
* do have and handle the rest in the next record.
*/
if (len == sizeof(struct xfs_trans_header))
xlog_recover_add_item(&trans->r_itemq); xlog_recover_add_item(&trans->r_itemq);
memcpy(&trans->r_theader, dp, len); memcpy(&trans->r_theader, dp, len);
return 0; return 0;
@ -4532,11 +4554,13 @@ xlog_recover(
xfs_sb_has_incompat_log_feature(&log->l_mp->m_sb, xfs_sb_has_incompat_log_feature(&log->l_mp->m_sb,
XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN)) { XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN)) {
xfs_warn(log->l_mp, xfs_warn(log->l_mp,
"Superblock has unknown incompatible log features (0x%x) enabled.\n" "Superblock has unknown incompatible log features (0x%x) enabled.",
"The log can not be fully and/or safely recovered by this kernel.\n"
"Please recover the log on a kernel that supports the unknown features.",
(log->l_mp->m_sb.sb_features_log_incompat & (log->l_mp->m_sb.sb_features_log_incompat &
XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN)); XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN));
xfs_warn(log->l_mp,
"The log can not be fully and/or safely recovered by this kernel.");
xfs_warn(log->l_mp,
"Please recover the log on a kernel that supports the unknown features.");
return -EINVAL; return -EINVAL;
} }

View file

@ -501,7 +501,7 @@ xfs_inactive_symlink_rmt(
/* /*
* Unmap the dead block(s) to the free_list. * Unmap the dead block(s) to the free_list.
*/ */
error = xfs_bunmapi(tp, ip, 0, size, XFS_BMAPI_METADATA, nmaps, error = xfs_bunmapi(tp, ip, 0, size, 0, nmaps,
&first_block, &free_list, &done); &first_block, &free_list, &done);
if (error) if (error)
goto error_bmap_cancel; goto error_bmap_cancel;