[Debian-ha-commits] [ocfs2-tools] 26/58: fsck.ocfs2: close ost_fs in case of check superblock fails

Valentin Vidic vvidic-guest at moszumanska.debian.org
Tue Jun 20 13:40:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

vvidic-guest pushed a commit to branch upstream
in repository ocfs2-tools.

commit db5dac21dc2f4849fbff7c8226fc545668eb8891
Author: Joseph Qi <joseph.qi at huawei.com>
Date:   Wed Sep 28 16:20:54 2016 +0800

    fsck.ocfs2: close ost_fs in case of check superblock fails
    
    open_and_check may happen that check_superblock fails after ocfs2_open.
    Currently it goes to out without close ost->ost_fs. So fix it.
    
    Signed-off-by: Joseph Qi <joseph.qi at huawei.com>
    Reviewed-by: Jun Piao <piaojun at huawei.com>
---
 fsck.ocfs2/fsck.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c
index dc5209d..d4fadc3 100644
--- a/fsck.ocfs2/fsck.c
+++ b/fsck.ocfs2/fsck.c
@@ -471,6 +471,7 @@ static errcode_t open_and_check(o2fsck_state *ost, char *filename,
 	if (ret) {
 		printf("fsck saw unrecoverable errors in the super block and "
 		       "will not continue.\n");
+		ocfs2_close(ost->ost_fs);
 		goto out;
 	}
 
@@ -1097,11 +1098,13 @@ close:
 		ocfs2_shutdown_dlm(ost->ost_fs, whoami);
 	block_signals(SIG_UNBLOCK);
 
-	ret = ocfs2_close(ost->ost_fs);
-	if (ret) {
-		com_err(whoami, ret, "while closing file \"%s\"", filename);
-		/* XXX I wonder about this error.. */
-		fsck_mask |= FSCK_ERROR;
+	if (ost->ost_fs) {
+		ret = ocfs2_close(ost->ost_fs);
+		if (ret) {
+			com_err(whoami, ret, "while closing file \"%s\"", filename);
+			/* XXX I wonder about this error.. */
+			fsck_mask |= FSCK_ERROR;
+		}
 	} 
 
 out:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/ocfs2-tools.git



More information about the Debian-HA-Commits mailing list