OSDN Git Service

xfs: remove leftover CoW reservations when remounting ro
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 14 Dec 2017 23:46:05 +0000 (15:46 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 21 Dec 2017 16:47:32 +0000 (08:47 -0800)
commit10ddf64e420f7f6c1a871bfb4ff2de08faef8235
tree3f5b443ae468fedff7b476c539513b3193b14bf1
parent363e59baa4f76d3f97c0133ff7014cba3d90a7c3
xfs: remove leftover CoW reservations when remounting ro

When we're remounting the filesystem readonly, remove all CoW
preallocations prior to going ro.  If the fs goes down after the ro
remount, we never clean up the staging extents, which means xfs_check
will trip over them on a subsequent run.  Practically speaking, the next
mount will clean them up too, so this is unlikely to be seen.  Since we
shut down the cowblocks cleaner on remount-ro, we also have to make sure
we start it back up if/when we remount-rw.

Found by adding clonerange to fsstress and running xfs/017.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_icache.c
fs/xfs/xfs_icache.h
fs/xfs/xfs_super.c