-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: open with RDWR for exclusive file lock #3780
fix: open with RDWR for exclusive file lock #3780
Conversation
ok to test |
Can one of the admins verify this patch? |
ok to test |
|
f042602
to
8b90e13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for the PR!
lib/events/uploader.go
Outdated
@@ -219,7 +219,7 @@ func (u *Uploader) emitEvent(e UploadEvent) { | |||
} | |||
|
|||
func (u *Uploader) uploadFile(lockFilePath string, sessionID session.ID) error { | |||
lockFile, err := os.Open(lockFilePath) | |||
lockFile, err := os.OpenFile(lockFilePath, os.O_RDWR, 0640) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Cleaner to just pass 0
for permission bits since we aren't using O_CREATE
(teleport is full of unused permission bits being passed to OpenFile
, so fixing this really isn't necessary).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fspmarshall good point, fixed 👍
In order to place an exclusive lock on NFS storage, the file must be opened for writing. Fixes gravitational#3779 Signed-off-by: Dominic Evans <[email protected]>
8b90e13
to
af4d437
Compare
In order to place an exclusive lock on NFS storage, the file must be
opened for writing.
Fixes #3779
Signed-off-by: Dominic Evans [email protected]