linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] xfsprogs: minor fixes for 5.7
@ 2020-07-14 21:45 Darrick J. Wong
  2020-07-14 21:46 ` [PATCH 1/1] xfs_copy: flush target devices before exiting Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2020-07-14 21:45 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: Dave Chinner, linux-xfs

Hi all,

This is a short series to collect various xfsprogs fixes for 5.7.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=xfsprogs-5.7-fixes
---
 copy/xfs_copy.c |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)


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

* [PATCH 1/1] xfs_copy: flush target devices before exiting
  2020-07-14 21:45 [PATCH v2 0/1] xfsprogs: minor fixes for 5.7 Darrick J. Wong
@ 2020-07-14 21:46 ` Darrick J. Wong
  2020-07-15 17:46   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2020-07-14 21:46 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: Dave Chinner, linux-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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
---
 copy/xfs_copy.c |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)


diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 2d087f71..38a20d37 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)
@@ -138,6 +139,14 @@ check_errors(void)
 	int	i, first_error = 0;
 
 	for (i = 0; i < num_targets; i++)  {
+		if (target[i].state != INACTIVE) {
+			if (platform_flush_device(target[i].fd, 0)) {
+				target[i].error = errno;
+				target[i].state = INACTIVE;
+				target[i].err_type = 2;
+			}
+		}
+
 		if (target[i].state == INACTIVE)  {
 			if (first_error == 0)  {
 				first_error++;
@@ -145,10 +154,21 @@ check_errors(void)
 				_("THE FOLLOWING COPIES FAILED TO COMPLETE\n"));
 			}
 			do_log("    %s -- ", target[i].name);
-			if (target[i].err_type == 0)
+			switch (target[i].err_type) {
+			case 0:
 				do_log(_("write error"));
-			else
+				break;
+			case 1:
 				do_log(_("lseek error"));
+				break;
+			case 2:
+				do_log(_("flush error"));
+				break;
+			default:
+				do_log(_("unknown error type %d"),
+						target[i].err_type);
+				break;
+			}
 			do_log(_(" at offset %lld\n"), target[i].position);
 		}
 	}


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

* Re: [PATCH 1/1] xfs_copy: flush target devices before exiting
  2020-07-14 21:46 ` [PATCH 1/1] xfs_copy: flush target devices before exiting Darrick J. Wong
@ 2020-07-15 17:46   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-07-15 17:46 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: sandeen, Dave Chinner, linux-xfs

On Tue, Jul 14, 2020 at 02:46:01PM -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>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

end of thread, other threads:[~2020-07-15 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 21:45 [PATCH v2 0/1] xfsprogs: minor fixes for 5.7 Darrick J. Wong
2020-07-14 21:46 ` [PATCH 1/1] xfs_copy: flush target devices before exiting Darrick J. Wong
2020-07-15 17:46   ` Christoph Hellwig

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).