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 branch 'xfs-fixes-for-3.14-rc4' of git://oss.sgi.com/xfs/xfs

Pull xfs fixes from Dave Chinner:
"This is the first pull request I've had to do for you, so I'm still
sorting things out. The reason I'm sending this and not Ben should be
obvious from the first commit below - SGI has stepped down from the
XFS maintainership role. As such, I'd like to take another
opportunity to thank them for their many years of effort maintaining
XFS and supporting the XFS community that they developed from the
ground up.

So I haven't had time to work things like signed tags into my
workflows yet, so this is just a repo branch I'm asking you to pull
from. And yes, I named the branch -rc4 because I wanted the fixes in
rc4, not because the branch was for merging into -rc3. Probably not
right, either.

Anyway, I should have everything sorted out by the time the next merge
window comes around. If there's anything that you don't like in the
pull req, feel free to flame me unmercifully.

The changes are fixes for recent regressions and important thinkos in
verification code:

- a log vector buffer alignment issue on ia32
- timestamps on truncate got mangled
- primary superblock CRC validation fixes and error message
sanitisation"

* 'xfs-fixes-for-3.14-rc4' of git://oss.sgi.com/xfs/xfs:
xfs: limit superblock corruption errors to actual corruption
xfs: skip verification on initial "guess" superblock read
MAINTAINERS: SGI no longer maintaining XFS
xfs: xfs_sb_read_verify() doesn't flag bad crcs on primary sb
xfs: ensure correct log item buffer alignment
xfs: ensure correct timestamp updates from truncate

+43 -27
-1
MAINTAINERS
··· 9728 9728 XFS FILESYSTEM 9729 9729 P: Silicon Graphics Inc 9730 9730 M: Dave Chinner <david@fromorbit.com> 9731 - M: Ben Myers <bpm@sgi.com> 9732 9731 M: xfs@oss.sgi.com 9733 9732 L: xfs@oss.sgi.com 9734 9733 W: http://oss.sgi.com/projects/xfs
+8 -8
fs/xfs/xfs_iops.c
··· 705 705 { 706 706 struct xfs_mount *mp = ip->i_mount; 707 707 struct inode *inode = VFS_I(ip); 708 - int mask = iattr->ia_valid; 709 708 xfs_off_t oldsize, newsize; 710 709 struct xfs_trans *tp; 711 710 int error; ··· 725 726 726 727 ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); 727 728 ASSERT(S_ISREG(ip->i_d.di_mode)); 728 - ASSERT((mask & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET| 729 - ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0); 729 + ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET| 730 + ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0); 730 731 731 732 oldsize = inode->i_size; 732 733 newsize = iattr->ia_size; ··· 735 736 * Short circuit the truncate case for zero length files. 736 737 */ 737 738 if (newsize == 0 && oldsize == 0 && ip->i_d.di_nextents == 0) { 738 - if (!(mask & (ATTR_CTIME|ATTR_MTIME))) 739 + if (!(iattr->ia_valid & (ATTR_CTIME|ATTR_MTIME))) 739 740 return 0; 740 741 741 742 /* ··· 823 824 * these flags set. For all other operations the VFS set these flags 824 825 * explicitly if it wants a timestamp update. 825 826 */ 826 - if (newsize != oldsize && (!(mask & (ATTR_CTIME | ATTR_MTIME)))) { 827 + if (newsize != oldsize && 828 + !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) { 827 829 iattr->ia_ctime = iattr->ia_mtime = 828 830 current_fs_time(inode->i_sb); 829 - mask |= ATTR_CTIME | ATTR_MTIME; 831 + iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME; 830 832 } 831 833 832 834 /* ··· 863 863 xfs_inode_clear_eofblocks_tag(ip); 864 864 } 865 865 866 - if (mask & ATTR_MODE) 866 + if (iattr->ia_valid & ATTR_MODE) 867 867 xfs_setattr_mode(ip, iattr); 868 - if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME)) 868 + if (iattr->ia_valid & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME)) 869 869 xfs_setattr_time(ip, iattr); 870 870 871 871 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+15 -4
fs/xfs/xfs_log_cil.c
··· 205 205 /* 206 206 * We 64-bit align the length of each iovec so that the start 207 207 * of the next one is naturally aligned. We'll need to 208 - * account for that slack space here. 208 + * account for that slack space here. Then round nbytes up 209 + * to 64-bit alignment so that the initial buffer alignment is 210 + * easy to calculate and verify. 209 211 */ 210 212 nbytes += niovecs * sizeof(uint64_t); 213 + nbytes = round_up(nbytes, sizeof(uint64_t)); 211 214 212 215 /* grab the old item if it exists for reservation accounting */ 213 216 old_lv = lip->li_lv; 214 217 215 - /* calc buffer size */ 216 - buf_size = sizeof(struct xfs_log_vec) + nbytes + 217 - niovecs * sizeof(struct xfs_log_iovec); 218 + /* 219 + * The data buffer needs to start 64-bit aligned, so round up 220 + * that space to ensure we can align it appropriately and not 221 + * overrun the buffer. 222 + */ 223 + buf_size = nbytes + 224 + round_up((sizeof(struct xfs_log_vec) + 225 + niovecs * sizeof(struct xfs_log_iovec)), 226 + sizeof(uint64_t)); 218 227 219 228 /* compare to existing item size */ 220 229 if (lip->li_lv && buf_size <= lip->li_lv->lv_size) { ··· 260 251 /* The allocated data region lies beyond the iovec region */ 261 252 lv->lv_buf_len = 0; 262 253 lv->lv_buf = (char *)lv + buf_size - nbytes; 254 + ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t))); 255 + 263 256 lip->li_ops->iop_format(lip, lv); 264 257 insert: 265 258 ASSERT(lv->lv_buf_len <= nbytes);
+16 -8
fs/xfs/xfs_mount.c
··· 282 282 struct xfs_sb *sbp = &mp->m_sb; 283 283 int error; 284 284 int loud = !(flags & XFS_MFSI_QUIET); 285 + const struct xfs_buf_ops *buf_ops; 285 286 286 287 ASSERT(mp->m_sb_bp == NULL); 287 288 ASSERT(mp->m_ddev_targp != NULL); 289 + 290 + /* 291 + * For the initial read, we must guess at the sector 292 + * size based on the block device. It's enough to 293 + * get the sb_sectsize out of the superblock and 294 + * then reread with the proper length. 295 + * We don't verify it yet, because it may not be complete. 296 + */ 297 + sector_size = xfs_getsize_buftarg(mp->m_ddev_targp); 298 + buf_ops = NULL; 288 299 289 300 /* 290 301 * Allocate a (locked) buffer to hold the superblock. 291 302 * This will be kept around at all times to optimize 292 303 * access to the superblock. 293 304 */ 294 - sector_size = xfs_getsize_buftarg(mp->m_ddev_targp); 295 - 296 305 reread: 297 306 bp = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR, 298 - BTOBB(sector_size), 0, 299 - loud ? &xfs_sb_buf_ops 300 - : &xfs_sb_quiet_buf_ops); 307 + BTOBB(sector_size), 0, buf_ops); 301 308 if (!bp) { 302 309 if (loud) 303 310 xfs_warn(mp, "SB buffer read failed"); ··· 335 328 } 336 329 337 330 /* 338 - * If device sector size is smaller than the superblock size, 339 - * re-read the superblock so the buffer is correctly sized. 331 + * Re-read the superblock so the buffer is correctly sized, 332 + * and properly verified. 340 333 */ 341 - if (sector_size < sbp->sb_sectsize) { 334 + if (buf_ops == NULL) { 342 335 xfs_buf_relse(bp); 343 336 sector_size = sbp->sb_sectsize; 337 + buf_ops = loud ? &xfs_sb_buf_ops : &xfs_sb_quiet_buf_ops; 344 338 goto reread; 345 339 } 346 340
+4 -6
fs/xfs/xfs_sb.c
··· 295 295 sbp->sb_dblocks == 0 || 296 296 sbp->sb_dblocks > XFS_MAX_DBLOCKS(sbp) || 297 297 sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp))) { 298 - XFS_CORRUPTION_ERROR("SB sanity check failed", 299 - XFS_ERRLEVEL_LOW, mp, sbp); 298 + xfs_notice(mp, "SB sanity check failed"); 300 299 return XFS_ERROR(EFSCORRUPTED); 301 300 } 302 301 ··· 610 611 XFS_SB_VERSION_5) || 611 612 dsb->sb_crc != 0)) { 612 613 613 - if (!xfs_verify_cksum(bp->b_addr, be16_to_cpu(dsb->sb_sectsize), 614 + if (!xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length), 614 615 offsetof(struct xfs_sb, sb_crc))) { 615 616 /* Only fail bad secondaries on a known V5 filesystem */ 616 - if (bp->b_bn != XFS_SB_DADDR && 617 + if (bp->b_bn == XFS_SB_DADDR || 617 618 xfs_sb_version_hascrc(&mp->m_sb)) { 618 619 error = EFSCORRUPTED; 619 620 goto out_error; ··· 624 625 625 626 out_error: 626 627 if (error) { 627 - if (error != EWRONGFS) 628 + if (error == EFSCORRUPTED) 628 629 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, 629 630 mp, bp->b_addr); 630 631 xfs_buf_ioerror(bp, error); ··· 642 643 struct xfs_buf *bp) 643 644 { 644 645 struct xfs_dsb *dsb = XFS_BUF_TO_SBP(bp); 645 - 646 646 647 647 if (dsb->sb_magicnum == cpu_to_be32(XFS_SB_MAGIC)) { 648 648 /* XFS filesystem, verify noisily! */