Hi all, This is a rollup of all the remaining patches I've sent in the past 9 days or so. If all goes well I hope to land this during the 4.16 merge. 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. Patches 1-2 reorganize 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 3 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. Patch 4 fixes a serious corruption problem with the cow extent allocation -- 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. The 5th patch fixes a hard to reproduce race between truncate and buffered CoW writeback. Writeback doesn't seem to take i_rwsem (aka the iolock) when it's gathering io requests, so it races with a truncate-down, which starts by reducing i_size before moving on to removing the pages from the page cache. If the writeback was to a shared block and we "win" the race, we'll return the CoW mapping but it'll be deemed invalid because it's beyond EOF. We then blow an assert when we try to go to the data fork for a valid mapping (because we should never do that!) though even any data fork mapping will also be invalidated and we ultimately don't write anything. The 6th patch fixes a NULL pointer deref because we incorrectly freed the inode btree cursor if there's an error while counting the blocks in the inode btree for rmapbt cross-referencing. Anyway, with this set applied I think we're ready to remove the reflink EXPERIMENTAL tag during the 4.16 cycle. --D -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html