Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbackup fails due to O_NOATIME flag in database open [CORE3199] #3573

Closed
firebird-automations opened this issue Oct 27, 2010 · 9 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Christian Heimes (tiran)

Is duplicated by CORE3540

Votes: 1

nbackup is unable to open a FDB file when the file is not owner by the current user although the current user has read permission. This happens because O_NOATIME is only allowed if the current user either owns the file or is root.

open(".../database.fdb", O_RDONLY|O_DIRECT|O_NOATIME) = -1 EPERM (Operation not permitted)

Proposed fix:

--- src/utilities/nbackup.cpp.orig 2010-10-27 03:00:32.068887122 +0200
+++ src/utilities/nbackup.cpp 2010-10-27 03:03:36.801352983 +0200
@@ -336,6 +336,10 @@
#⁠define O_DIRECT 0
#⁠endif // O_DIRECT
dbase = open(dbname.c_str(), O_RDONLY | O_LARGEFILE | O_NOATIME | O_DIRECT);
+ if (dbase < 0 && O_NOATIME)
+ // O_NOATIME fails unless we are either root or the owner of the file
+ // try again without O_NOATIME
+ dbase = open(dbname.c_str(), O_RDONLY | O_LARGEFILE | O_DIRECT);
if (dbase < 0)
b_error::raise("Error (%d) opening database file: %s", errno, dbname.c_str());
#⁠ifdef HAVE_POSIX_FADVISE

Commits: 016fd3b c4c34a7

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Version: 3.0 Initial [ 10301 ]

summary: nackup fails due O_NOATIME => nackup fails due to O_NOATIME flag in database open

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Slightly modified patch applied.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5.1 [ 10333 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

summary: nackup fails due to O_NOATIME flag in database open => nbackup fails due to O_NOATIME flag in database open

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Link: This issue is duplicated by CORE3540 [ CORE3540 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test => Cannot be tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment