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

Commit324076a

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 parent99fb443 commit324076a

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
@@ -863,7 +863,8 @@ tar_close(Walfile f, WalCloseMethod method)
863863
return-1;
864864

865865
/* Always fsync on close, so the padding gets fsynced */
866-
tar_sync(f);
866+
if (tar_sync(f)<0)
867+
return-1;
867868

868869
/* Clean up and done */
869870
pg_free(tf->pathname);
@@ -894,7 +895,7 @@ tar_finish(void)
894895
return false;
895896
}
896897

897-
/* A tarfile always ends with two emptyblocks */
898+
/* A tarfile always ends with two empty blocks */
898899
MemSet(zerobuf,0,sizeof(zerobuf));
899900
if (!tar_data->compression)
900901
{
@@ -955,7 +956,10 @@ tar_finish(void)
955956

956957
/* sync the empty blocks as well, since they're after the last file */
957958
if (tar_data->sync)
958-
fsync(tar_data->fd);
959+
{
960+
if (fsync(tar_data->fd)!=0)
961+
return false;
962+
}
959963

960964
if (close(tar_data->fd)!=0)
961965
return false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp