Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33044dc4 authored by Dave Chinner's avatar Dave Chinner
Browse files

Merge branch 'xfs-misc-fixes-for-3.18-2' into for-next

parents f6d31f4b 2ebff7bb
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -270,7 +270,6 @@ xfs_dir3_data_get_ftype(
{
	__uint8_t	ftype = dep->name[dep->namelen];

	ASSERT(ftype < XFS_DIR3_FT_MAX);
	if (ftype >= XFS_DIR3_FT_MAX)
		return XFS_DIR3_FT_UNKNOWN;
	return ftype;
+1 −1
Original line number Diff line number Diff line
@@ -1646,7 +1646,7 @@ xfs_swap_extents_check_format(
	return 0;
}

int
static int
xfs_swap_extent_flush(
	struct xfs_inode	*ip)
{
+1 −1
Original line number Diff line number Diff line
@@ -501,7 +501,7 @@ xfs_buf_item_unpin(
 * buffer being bad..
 */

DEFINE_RATELIMIT_STATE(xfs_buf_write_fail_rl_state, 30 * HZ, 10);
static DEFINE_RATELIMIT_STATE(xfs_buf_write_fail_rl_state, 30 * HZ, 10);

STATIC uint
xfs_buf_item_push(
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
#include "xfs_trace.h"
#include "xfs_icache.h"
#include "xfs_bmap_util.h"
#include "xfs_quota.h"
#include "xfs_dquot_item.h"
#include "xfs_dquot.h"

+30 −0
Original line number Diff line number Diff line
@@ -849,6 +849,36 @@ xfs_setattr_size(
		return error;
	truncate_setsize(inode, newsize);

	/*
	 * The "we can't serialise against page faults" pain gets worse.
	 *
	 * If the file is mapped then we have to clean the page at the old EOF
	 * when extending the file. Extending the file can expose changes the
	 * underlying page mapping (e.g. from beyond EOF to a hole or
	 * unwritten), and so on the next attempt to write to that page we need
	 * to remap it for write. i.e. we need .page_mkwrite() to be called.
	 * Hence we need to clean the page to clean the pte and so a new write
	 * fault will be triggered appropriately.
	 *
	 * If we do it before we change the inode size, then we can race with a
	 * page fault that maps the page with exactly the same problem. If we do
	 * it after we change the file size, then a new page fault can come in
	 * and allocate space before we've run the rest of the truncate
	 * transaction. That's kinda grotesque, but it's better than have data
	 * over a hole, and so that's the lesser evil that has been chosen here.
	 *
	 * The real solution, however, is to have some mechanism for locking out
	 * page faults while a truncate is in progress.
	 */
	if (newsize > oldsize && mapping_mapped(VFS_I(ip)->i_mapping)) {
		error = filemap_write_and_wait_range(
				VFS_I(ip)->i_mapping,
				round_down(oldsize, PAGE_CACHE_SIZE),
				round_up(oldsize, PAGE_CACHE_SIZE) - 1);
		if (error)
			return error;
	}

	tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_SIZE);
	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_itruncate, 0, 0);
	if (error)
Loading