linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] xfs: reflink/scrub/quota fixes
@ 2018-01-27  1:10 Darrick J. Wong
  2018-01-27  1:10 ` [PATCH 1/7] xfs: reflink should break pnfs leases before sharing blocks Darrick J. Wong
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Darrick J. Wong @ 2018-01-27  1:10 UTC (permalink / raw)
  To: hch, bfoster, darrick.wong; +Cc: linux-xfs

Hi all,

This is a re-roll of five patches that have generated a lot of review
comments; hopefully they're ready to go.  Some of the patches already
have reviewed-bys, but the discussion so choppy I decided that I'd just
republish the whole set.

Running generic/232 with quotas and reflink demonstrated that there was
something wrong with the way we did quota accounting -- on an otherwise
idle system, fs-wide du block count numbers didn't match the quota
reports.  I started digging into why the quota accounting was wrong, and
the following are the results of my bug hunt.  Regression tests have
been sent to the fstests lists.

The first patch fixes reflink to break pnfs leases before reflinking as
we take the iolocks of both inodes.  Patches 2-3 restructure the locking
code to take shared locks on the source file whenever possible, to
reduce lock contention.

The fourth patch reorganizes the copy on write quota updating code to
reflect how the CoW fork works now.  In short, the CoW fork is entirely
in memory, so we can only use the in-memory quota reservation counters
for all CoW blocks; the accounting only becomes permanent if we remap an
extent into the data fork.

Patch 5 creates a separate i_cow_blocks counter to track all the CoW
blocks assigned to a file, which makes changing a file's uid/gid/prjid
easier, makes reporting cow blocks via stat easy, and enables various
cleanups.  This also makes it so that we avoid unnecesary eofblocks
scanning on a file with speculative cow preallocations.

Patches 6-7 fixes a serious corruption problem with direct io cow
writes.  If extent allocation returns no error and no mapping, we must
return ENOSPC to the caller because otherwise we pass a garbage mapping
to the dio code and the write shoots into space.  Bad.

Patch 8 fixes a problem with direct IO writes (regular and cow)
returning ENOSPC when there's plenty of free space.  When we allocate
into the CoW fork with the cow extent size hint set, the allocator
enlarges the allocation request to try to hit alignment goals.  However,
if the allocated extent does not actually fulfill any of the requested
range, we send a garbage zero-length extent back to the iomap code
(which also doesn't notice), and the write lands at the startblock of
the garbage extent.  The fix is to detect that we didn't fill the entire
requested range and fix up the returned mapping so that we always fill
the first block of the requested allocation and for CoW to check the
validity returned mappings before blowing things up.  This also fixes a
problem where a direct io overwrite can return ENOSPC to userspace
because of the same fragmentation problem.

Sorry the maintainer^Wpatches has been so volatile and rapidfire
recently; the end of the 4.15 cycle and some major $distrokernel
deadlines have made for a hellishly busy week.

--D

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-01-30 11:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-27  1:10 [PATCH v3 0/7] xfs: reflink/scrub/quota fixes Darrick J. Wong
2018-01-27  1:10 ` [PATCH 1/7] xfs: reflink should break pnfs leases before sharing blocks Darrick J. Wong
2018-01-27  7:31   ` Christoph Hellwig
2018-01-27  1:10 ` [PATCH 2/7] xfs: allow xfs_lock_two_inodes to take different EXCL/SHARED modes Darrick J. Wong
2018-01-27  7:32   ` Christoph Hellwig
2018-01-27  1:10 ` [PATCH 3/7] xfs: only grab shared inode locks for source file during reflink Darrick J. Wong
2018-01-27  7:33   ` Christoph Hellwig
2018-01-27  1:10 ` [PATCH 4/7] xfs: treat CoW fork operations as delalloc for quota accounting Darrick J. Wong
2018-01-27  7:33   ` Christoph Hellwig
2018-01-29 12:26   ` Brian Foster
2018-01-29 23:00     ` Darrick J. Wong
2018-01-30 11:48       ` Brian Foster
2018-01-27  1:10 ` [PATCH 5/7] iomap: warn on zero-length mappings Darrick J. Wong
2018-01-27  7:34   ` Christoph Hellwig
2018-01-27 18:04     ` Darrick J. Wong
2018-01-27 18:08   ` [PATCH v2 " Darrick J. Wong
2018-01-27  1:10 ` [PATCH 6/7] xfs: check reflink allocation mappings Darrick J. Wong
2018-01-27  7:35   ` Christoph Hellwig
2018-01-27  1:10 ` [PATCH 7/7] xfs: don't screw up direct writes when freesp is fragmented Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).