Merge tag 'xfs-4.18-merge-10' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull more xfs updates from Darrick Wong: "Here's the second round of patches for XFS for 4.18. Most of the commits are small cleanups, bug fixes, and continued strengthening of metadata verifiers; the bulk of the diff is the conversion of the fs/xfs/ tree to use SPDX tags. This series has been run through a full xfstests run over the weekend and through a quick xfstests run against this morning's master, with no major failures reported. Summary: - Strengthen metadata checking to avoid ASSERTing on bad disk contents - Validate btree records that are being retrieved for clients - Strengthen root inode verification - Convert license blurbs to SPDX tags - Enable changing DAX flag on directories - Fix some writeback deadlocks in reflink - Refactor out some old xfs helpers - Move type verifiers to a separate file - Fix some fuzzer crashes - Various other bug fixes" * tag 'xfs-4.18-merge-10' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (31 commits) xfs: update incore per-AG inode count xfs: replace do_mod with native operations xfs: don't call xfs_da_shrink_inode with NULL bp xfs: clean up MIN/MAX xfs: move various type verifiers to common file xfs: xfs_reflink_convert_cow() memory allocation deadlock xfs: setup VFS i_rwsem lockdep state correctly xfs: fix string handling in label get/set functions xfs: convert to SPDX license tags xfs: validate btree records on retrieval xfs: push corruption -> ESTALE conversion to xfs_nfs_get_inode() xfs: verify root inode more thoroughly xfs: verify COW extent size hint is valid in inode verifier xfs: verify extent size hint is valid in inode verifier xfs: catch bad stripe alignment configurations iomap: fsync swap files before iterating mappings xfs: use xfs_trans_getsb in xfs_sync_sb_buf xfs: don't assert on corrupted unlinked inode list xfs: explicitly pass buffer size to xfs_corruption_error xfs: don't assert when on-disk btree pointers are garbage ...
This commit is contained in:
@@ -1,19 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it would be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_fs.h"
|
||||
@@ -1094,12 +1082,14 @@ xfs_ioctl_setattr_dax_invalidate(
|
||||
/*
|
||||
* It is only valid to set the DAX flag on regular files and
|
||||
* directories on filesystems where the block size is equal to the page
|
||||
* size. On directories it serves as an inherit hint.
|
||||
* size. On directories it serves as an inherited hint so we don't
|
||||
* have to check the device for dax support or flush pagecache.
|
||||
*/
|
||||
if (fa->fsx_xflags & FS_XFLAG_DAX) {
|
||||
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
|
||||
return -EINVAL;
|
||||
if (!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
|
||||
if (S_ISREG(inode->i_mode) &&
|
||||
!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
|
||||
sb->s_blocksize))
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1110,6 +1100,9 @@ xfs_ioctl_setattr_dax_invalidate(
|
||||
if (!(fa->fsx_xflags & FS_XFLAG_DAX) && !IS_DAX(inode))
|
||||
return 0;
|
||||
|
||||
if (S_ISDIR(inode->i_mode))
|
||||
return 0;
|
||||
|
||||
/* lock, flush and invalidate mapping in preparation for flag change */
|
||||
xfs_ilock(ip, XFS_MMAPLOCK_EXCL | XFS_IOLOCK_EXCL);
|
||||
error = filemap_write_and_wait(inode->i_mapping);
|
||||
@@ -1819,13 +1812,13 @@ xfs_ioc_getlabel(
|
||||
/* Paranoia */
|
||||
BUILD_BUG_ON(sizeof(sbp->sb_fname) > FSLABEL_MAX);
|
||||
|
||||
/* 1 larger than sb_fname, so this ensures a trailing NUL char */
|
||||
memset(label, 0, sizeof(label));
|
||||
spin_lock(&mp->m_sb_lock);
|
||||
strncpy(label, sbp->sb_fname, sizeof(sbp->sb_fname));
|
||||
strncpy(label, sbp->sb_fname, XFSLABEL_MAX);
|
||||
spin_unlock(&mp->m_sb_lock);
|
||||
|
||||
/* xfs on-disk label is 12 chars, be sure we send a null to user */
|
||||
label[XFSLABEL_MAX] = '\0';
|
||||
if (copy_to_user(user_label, label, sizeof(sbp->sb_fname)))
|
||||
if (copy_to_user(user_label, label, sizeof(label)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
@@ -1861,7 +1854,7 @@ xfs_ioc_setlabel(
|
||||
|
||||
spin_lock(&mp->m_sb_lock);
|
||||
memset(sbp->sb_fname, 0, sizeof(sbp->sb_fname));
|
||||
strncpy(sbp->sb_fname, label, sizeof(sbp->sb_fname));
|
||||
memcpy(sbp->sb_fname, label, len);
|
||||
spin_unlock(&mp->m_sb_lock);
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user