Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd08c3d5

Browse files
committed
Correct handling of fsync failures with tar mode of walmethods.c
This file has been missing the fact that it needs to report back tocallers a proper failure on fsync calls. I have spotted the one intar_finish() while Kuntal has spotted the one in tar_close().Backpatch down to 10 where this code has been introduced.Reported by: Michael Paquier, Kuntal GhoshAuthor: Michael PaquierReviewed-by: Kuntal Ghosh, Magnus HaganderDiscussion:https://postgr.es/m/20180625024356.GD1146@paquier.xyz
1 parent322548a commitd08c3d5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎src/bin/pg_basebackup/walmethods.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,8 @@ tar_close(Walfile f, WalCloseMethod method)
865865
return-1;
866866

867867
/* Always fsync on close, so the padding gets fsynced */
868-
tar_sync(f);
868+
if (tar_sync(f)<0)
869+
return-1;
869870

870871
/* Clean up and done */
871872
pg_free(tf->pathname);
@@ -896,7 +897,7 @@ tar_finish(void)
896897
return false;
897898
}
898899

899-
/* A tarfile always ends with two emptyblocks */
900+
/* A tarfile always ends with two empty blocks */
900901
MemSet(zerobuf,0,sizeof(zerobuf));
901902
if (!tar_data->compression)
902903
{
@@ -957,7 +958,10 @@ tar_finish(void)
957958

958959
/* sync the empty blocks as well, since they're after the last file */
959960
if (tar_data->sync)
960-
fsync(tar_data->fd);
961+
{
962+
if (fsync(tar_data->fd)!=0)
963+
return false;
964+
}
961965

962966
if (close(tar_data->fd)!=0)
963967
return false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp