Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'xfs-for-linus-v3.12-rc3' of git://oss.sgi.com/xfs/xfs

Pull xfs bugfixes from Ben Myers:
- fix for directory node collapse regression
- fix for recovery over stale on disk structures
- fix for eofblocks ioctl
- fix asserts in xfs_inode_free
- lock the ail before removing an item from it

* tag 'xfs-for-linus-v3.12-rc3' of git://oss.sgi.com/xfs/xfs:
xfs: fix node forward in xfs_node_toosmall
xfs: log recovery lsn ordering needs uuid check
xfs: fix XFS_IOC_FREE_EOFBLOCKS definition
xfs: asserting lock not held during freeing not valid
xfs: lock the AIL before removing the buffer item

+68 -22
+1
fs/xfs/xfs_buf_item.c
··· 628 628 else if (aborted) { 629 629 ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp)); 630 630 if (lip->li_flags & XFS_LI_IN_AIL) { 631 + spin_lock(&lip->li_ailp->xa_lock); 631 632 xfs_trans_ail_delete(lip->li_ailp, lip, 632 633 SHUTDOWN_LOG_IO_ERROR); 633 634 }
+3 -2
fs/xfs/xfs_da_btree.c
··· 1224 1224 /* start with smaller blk num */ 1225 1225 forward = nodehdr.forw < nodehdr.back; 1226 1226 for (i = 0; i < 2; forward = !forward, i++) { 1227 + struct xfs_da3_icnode_hdr thdr; 1227 1228 if (forward) 1228 1229 blkno = nodehdr.forw; 1229 1230 else ··· 1237 1236 return(error); 1238 1237 1239 1238 node = bp->b_addr; 1240 - xfs_da3_node_hdr_from_disk(&nodehdr, node); 1239 + xfs_da3_node_hdr_from_disk(&thdr, node); 1241 1240 xfs_trans_brelse(state->args->trans, bp); 1242 1241 1243 - if (count - nodehdr.count >= 0) 1242 + if (count - thdr.count >= 0) 1244 1243 break; /* fits with at least 25% to spare */ 1245 1244 } 1246 1245 if (i >= 2) {
+1 -1
fs/xfs/xfs_fs.h
··· 515 515 /* XFS_IOC_GETBIOSIZE ---- deprecated 47 */ 516 516 #define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap) 517 517 #define XFS_IOC_ZERO_RANGE _IOW ('X', 57, struct xfs_flock64) 518 - #define XFS_IOC_FREE_EOFBLOCKS _IOR ('X', 58, struct xfs_eofblocks) 518 + #define XFS_IOC_FREE_EOFBLOCKS _IOR ('X', 58, struct xfs_fs_eofblocks) 519 519 520 520 /* 521 521 * ioctl commands that replace IRIX syssgi()'s
+4 -5
fs/xfs/xfs_icache.c
··· 119 119 ip->i_itemp = NULL; 120 120 } 121 121 122 - /* asserts to verify all state is correct here */ 123 - ASSERT(atomic_read(&ip->i_pincount) == 0); 124 - ASSERT(!spin_is_locked(&ip->i_flags_lock)); 125 - ASSERT(!xfs_isiflocked(ip)); 126 - 127 122 /* 128 123 * Because we use RCU freeing we need to ensure the inode always 129 124 * appears to be reclaimed with an invalid inode number when in the ··· 129 134 ip->i_flags = XFS_IRECLAIM; 130 135 ip->i_ino = 0; 131 136 spin_unlock(&ip->i_flags_lock); 137 + 138 + /* asserts to verify all state is correct here */ 139 + ASSERT(atomic_read(&ip->i_pincount) == 0); 140 + ASSERT(!xfs_isiflocked(ip)); 132 141 133 142 call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback); 134 143 }
+59 -14
fs/xfs/xfs_log_recover.c
··· 1970 1970 * magic number. If we don't recognise the magic number in the buffer, then 1971 1971 * return a LSN of -1 so that the caller knows it was an unrecognised block and 1972 1972 * so can recover the buffer. 1973 + * 1974 + * Note: we cannot rely solely on magic number matches to determine that the 1975 + * buffer has a valid LSN - we also need to verify that it belongs to this 1976 + * filesystem, so we need to extract the object's LSN and compare it to that 1977 + * which we read from the superblock. If the UUIDs don't match, then we've got a 1978 + * stale metadata block from an old filesystem instance that we need to recover 1979 + * over the top of. 1973 1980 */ 1974 1981 static xfs_lsn_t 1975 1982 xlog_recover_get_buf_lsn( ··· 1987 1980 __uint16_t magic16; 1988 1981 __uint16_t magicda; 1989 1982 void *blk = bp->b_addr; 1983 + uuid_t *uuid; 1984 + xfs_lsn_t lsn = -1; 1990 1985 1991 1986 /* v4 filesystems always recover immediately */ 1992 1987 if (!xfs_sb_version_hascrc(&mp->m_sb)) ··· 2001 1992 case XFS_ABTB_MAGIC: 2002 1993 case XFS_ABTC_MAGIC: 2003 1994 case XFS_IBT_CRC_MAGIC: 2004 - case XFS_IBT_MAGIC: 2005 - return be64_to_cpu( 2006 - ((struct xfs_btree_block *)blk)->bb_u.s.bb_lsn); 1995 + case XFS_IBT_MAGIC: { 1996 + struct xfs_btree_block *btb = blk; 1997 + 1998 + lsn = be64_to_cpu(btb->bb_u.s.bb_lsn); 1999 + uuid = &btb->bb_u.s.bb_uuid; 2000 + break; 2001 + } 2007 2002 case XFS_BMAP_CRC_MAGIC: 2008 - case XFS_BMAP_MAGIC: 2009 - return be64_to_cpu( 2010 - ((struct xfs_btree_block *)blk)->bb_u.l.bb_lsn); 2003 + case XFS_BMAP_MAGIC: { 2004 + struct xfs_btree_block *btb = blk; 2005 + 2006 + lsn = be64_to_cpu(btb->bb_u.l.bb_lsn); 2007 + uuid = &btb->bb_u.l.bb_uuid; 2008 + break; 2009 + } 2011 2010 case XFS_AGF_MAGIC: 2012 - return be64_to_cpu(((struct xfs_agf *)blk)->agf_lsn); 2011 + lsn = be64_to_cpu(((struct xfs_agf *)blk)->agf_lsn); 2012 + uuid = &((struct xfs_agf *)blk)->agf_uuid; 2013 + break; 2013 2014 case XFS_AGFL_MAGIC: 2014 - return be64_to_cpu(((struct xfs_agfl *)blk)->agfl_lsn); 2015 + lsn = be64_to_cpu(((struct xfs_agfl *)blk)->agfl_lsn); 2016 + uuid = &((struct xfs_agfl *)blk)->agfl_uuid; 2017 + break; 2015 2018 case XFS_AGI_MAGIC: 2016 - return be64_to_cpu(((struct xfs_agi *)blk)->agi_lsn); 2019 + lsn = be64_to_cpu(((struct xfs_agi *)blk)->agi_lsn); 2020 + uuid = &((struct xfs_agi *)blk)->agi_uuid; 2021 + break; 2017 2022 case XFS_SYMLINK_MAGIC: 2018 - return be64_to_cpu(((struct xfs_dsymlink_hdr *)blk)->sl_lsn); 2023 + lsn = be64_to_cpu(((struct xfs_dsymlink_hdr *)blk)->sl_lsn); 2024 + uuid = &((struct xfs_dsymlink_hdr *)blk)->sl_uuid; 2025 + break; 2019 2026 case XFS_DIR3_BLOCK_MAGIC: 2020 2027 case XFS_DIR3_DATA_MAGIC: 2021 2028 case XFS_DIR3_FREE_MAGIC: 2022 - return be64_to_cpu(((struct xfs_dir3_blk_hdr *)blk)->lsn); 2029 + lsn = be64_to_cpu(((struct xfs_dir3_blk_hdr *)blk)->lsn); 2030 + uuid = &((struct xfs_dir3_blk_hdr *)blk)->uuid; 2031 + break; 2023 2032 case XFS_ATTR3_RMT_MAGIC: 2024 - return be64_to_cpu(((struct xfs_attr3_rmt_hdr *)blk)->rm_lsn); 2033 + lsn = be64_to_cpu(((struct xfs_attr3_rmt_hdr *)blk)->rm_lsn); 2034 + uuid = &((struct xfs_attr3_rmt_hdr *)blk)->rm_uuid; 2035 + break; 2025 2036 case XFS_SB_MAGIC: 2026 - return be64_to_cpu(((struct xfs_dsb *)blk)->sb_lsn); 2037 + lsn = be64_to_cpu(((struct xfs_dsb *)blk)->sb_lsn); 2038 + uuid = &((struct xfs_dsb *)blk)->sb_uuid; 2039 + break; 2027 2040 default: 2028 2041 break; 2042 + } 2043 + 2044 + if (lsn != (xfs_lsn_t)-1) { 2045 + if (!uuid_equal(&mp->m_sb.sb_uuid, uuid)) 2046 + goto recover_immediately; 2047 + return lsn; 2029 2048 } 2030 2049 2031 2050 magicda = be16_to_cpu(((struct xfs_da_blkinfo *)blk)->magic); ··· 2061 2024 case XFS_DIR3_LEAF1_MAGIC: 2062 2025 case XFS_DIR3_LEAFN_MAGIC: 2063 2026 case XFS_DA3_NODE_MAGIC: 2064 - return be64_to_cpu(((struct xfs_da3_blkinfo *)blk)->lsn); 2027 + lsn = be64_to_cpu(((struct xfs_da3_blkinfo *)blk)->lsn); 2028 + uuid = &((struct xfs_da3_blkinfo *)blk)->uuid; 2029 + break; 2065 2030 default: 2066 2031 break; 2032 + } 2033 + 2034 + if (lsn != (xfs_lsn_t)-1) { 2035 + if (!uuid_equal(&mp->m_sb.sb_uuid, uuid)) 2036 + goto recover_immediately; 2037 + return lsn; 2067 2038 } 2068 2039 2069 2040 /*