about summary refs log tree commit homepage
path: root/mgmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'mgmt.c')
-rw-r--r--mgmt.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mgmt.c b/mgmt.c
index b6b2aa5..5726ab7 100644
--- a/mgmt.c
+++ b/mgmt.c
@@ -12,6 +12,7 @@ static void mgmt_digest_step(struct mog_fd *mfd)
         struct mog_mgmt *mgmt = &mfd->as.mgmt;
         struct mog_fd *fmfd = mgmt->forward;
         enum mog_digest_next next;
+        struct mog_digest *digest = &fmfd->as.file.digest;
 
         /*
          * MOG_PRIO_FSCK means we're likely the _only_ thread handling
@@ -21,13 +22,16 @@ static void mgmt_digest_step(struct mog_fd *mfd)
                 int ioprio = mog_ioprio_drop();
 
                 do {
-                        next = mog_digest_read(&fmfd->as.file.digest, fmfd->fd);
+                        if (mog_socket_alive(mfd))
+                                next = mog_digest_read(digest, fmfd->fd);
+                        else
+                                next = MOG_DIGEST_ABORT;
                 } while (next == MOG_DIGEST_CONTINUE);
 
                 if (ioprio != -1)
                         mog_ioprio_restore(ioprio);
         } else {
-                next = mog_digest_read(&fmfd->as.file.digest, fmfd->fd);
+                next = mog_digest_read(digest, fmfd->fd);
         }
 
         assert(mgmt->wbuf == NULL && "wbuf should be NULL here");
@@ -39,6 +43,11 @@ static void mgmt_digest_step(struct mog_fd *mfd)
                 break;
         case MOG_DIGEST_ERROR:
                 mog_mgmt_fn_digest_err(mgmt);
+                break;
+        case MOG_DIGEST_ABORT:
+                syslog(LOG_ERR, "fd=%d aborted while waiting for fsck",
+                       mfd->fd);
+                mgmt->wbuf = MOG_WR_ERROR; /* fake the error */
         }
 
         if (mgmt->prio == MOG_PRIO_FSCK)