Skip to content

Commit

Permalink
Do not call fdatasync() and fix m_flags->flags_
Browse files Browse the repository at this point in the history
Fixes #1227: Fix fadvise bug

Suggested changes implemented:
 - #496 (comment)
 - #496 (comment)
  • Loading branch information
gjelu committed Apr 30, 2020
1 parent f3bd208 commit ea66639
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions core/src/findlib/bfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,7 @@ int bclose(BareosWinFilePacket* bfd)
} else {
#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
/* If not RDWR or WRONLY must be Read Only */
if (!(bfd->m_flags & (O_RDWR|O_WRONLY))) {
fdatasync(bfd->fid); /* sync the file */
if (!(bfd->flags_ & (O_RDWR|O_WRONLY))) {
/* Tell OS we don't need it any more */
posix_fadvise(bfd->fid, 0, 0, POSIX_FADV_DONTNEED);
Dmsg1(400, "Did posix_fadvise DONTNEED on fid=%d\n", bfd->fid);
Expand Down

0 comments on commit ea66639

Please sign in to comment.