Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] xfs_copy: flush target devices before exiting
@ 2020-06-08 18:44 Darrick J. Wong
  2020-06-08 18:45 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2020-06-08 18:44 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

Flush the devices we're copying to before exiting, so that we can report
any write errors.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 copy/xfs_copy.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 2d087f71..45ee2e06 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -12,6 +12,7 @@
 #include <stdarg.h>
 #include "xfs_copy.h"
 #include "libxlog.h"
+#include "libfrog/platform.h"
 
 #define	rounddown(x, y)	(((x)/(y))*(y))
 #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
@@ -150,6 +151,9 @@ check_errors(void)
 			else
 				do_log(_("lseek error"));
 			do_log(_(" at offset %lld\n"), target[i].position);
+		} else if (platform_flush_device(target[i].fd, 0)) {
+			do_log(_("    %s -- flush error %d"),
+					target[i].name, errno);
 		}
 	}
 	if (first_error == 0)  {

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

* Re: [PATCH] xfs_copy: flush target devices before exiting
  2020-06-08 18:44 [PATCH] xfs_copy: flush target devices before exiting Darrick J. Wong
@ 2020-06-08 18:45 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2020-06-08 18:45 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

On Mon, Jun 08, 2020 at 11:44:00AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Flush the devices we're copying to before exiting, so that we can report
> any write errors.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  copy/xfs_copy.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
> index 2d087f71..45ee2e06 100644
> --- a/copy/xfs_copy.c
> +++ b/copy/xfs_copy.c
> @@ -12,6 +12,7 @@
>  #include <stdarg.h>
>  #include "xfs_copy.h"
>  #include "libxlog.h"
> +#include "libfrog/platform.h"
>  
>  #define	rounddown(x, y)	(((x)/(y))*(y))
>  #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
> @@ -150,6 +151,9 @@ check_errors(void)
>  			else
>  				do_log(_("lseek error"));
>  			do_log(_(" at offset %lld\n"), target[i].position);
> +		} else if (platform_flush_device(target[i].fd, 0)) {
> +			do_log(_("    %s -- flush error %d"),
> +					target[i].name, errno);

NAK, this should set first_error.  Boooo...

--D

>  		}
>  	}
>  	if (first_error == 0)  {

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

end of thread, other threads:[~2020-06-08 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-08 18:44 [PATCH] xfs_copy: flush target devices before exiting Darrick J. Wong
2020-06-08 18:45 ` 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