[PATCH 18/17] xfs_scrub: fix reporting if we can't open raw block devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

The error checking logic for opening the data, log, and rt device is
totally broken.  Fix this.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 scrub/phase1.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/scrub/phase1.c b/scrub/phase1.c
index 4f028249..fd1050c9 100644
--- a/scrub/phase1.c
+++ b/scrub/phase1.c
@@ -170,9 +170,9 @@ _("Unable to find realtime device path."));
 
 	/* Open the raw devices. */
 	ctx->datadev = disk_open(ctx->fsinfo.fs_name);
-	if (error) {
-		str_errno(ctx, ctx->fsinfo.fs_name);
-		return error;
+	if (!ctx->datadev) {
+		str_error(ctx, ctx->mntpoint, _("Unable to open data device."));
+		return ECANCELED;
 	}
 
 	ctx->nr_io_threads = disk_heads(ctx->datadev);
@@ -184,16 +184,18 @@ _("Unable to find realtime device path."));
 
 	if (ctx->fsinfo.fs_log) {
 		ctx->logdev = disk_open(ctx->fsinfo.fs_log);
-		if (error) {
-			str_errno(ctx, ctx->fsinfo.fs_name);
-			return error;
+		if (!ctx->logdev) {
+			str_error(ctx, ctx->mntpoint,
+				_("Unable to open external log device."));
+			return ECANCELED;
 		}
 	}
 	if (ctx->fsinfo.fs_rt) {
 		ctx->rtdev = disk_open(ctx->fsinfo.fs_rt);
-		if (error) {
-			str_errno(ctx, ctx->fsinfo.fs_name);
-			return error;
+		if (!ctx->rtdev) {
+			str_error(ctx, ctx->mntpoint,
+				_("Unable to open realtime device."));
+			return ECANCELED;
 		}
 	}
 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux