diff options
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
| -rw-r--r-- | fs/xfs/xfs_log_recover.c | 26 | 
1 files changed, 23 insertions, 3 deletions
| diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 53366cc0bc9e..96c997ed2ec8 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -27,7 +27,7 @@  #include "xfs_buf_item.h"  #include "xfs_ag.h"  #include "xfs_quota.h" - +#include "xfs_reflink.h"  #define BLK_AVG(blk1, blk2)	((blk1+blk2) >> 1) @@ -3498,6 +3498,28 @@ xlog_recover_finish(  	xlog_recover_process_iunlinks(log);  	xlog_recover_check_summary(log); + +	/* +	 * Recover any CoW staging blocks that are still referenced by the +	 * ondisk refcount metadata.  During mount there cannot be any live +	 * staging extents as we have not permitted any user modifications. +	 * Therefore, it is safe to free them all right now, even on a +	 * read-only mount. +	 */ +	error = xfs_reflink_recover_cow(log->l_mp); +	if (error) { +		xfs_alert(log->l_mp, +	"Failed to recover leftover CoW staging extents, err %d.", +				error); +		/* +		 * If we get an error here, make sure the log is shut down +		 * but return zero so that any log items committed since the +		 * end of intents processing can be pushed through the CIL +		 * and AIL. +		 */ +		xfs_force_shutdown(log->l_mp, SHUTDOWN_LOG_IO_ERROR); +	} +  	return 0;  } @@ -3528,8 +3550,6 @@ xlog_recover_check_summary(  	uint64_t		ifree;  	int			error; -	mp = log->l_mp; -  	freeblks = 0LL;  	itotal = 0LL;  	ifree = 0LL; |