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

dyn-config: try to read it again in case the pagecache is not flushed out #548

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lxbsz
Copy link
Collaborator

@lxbsz lxbsz commented Apr 29, 2019

In-case if the editor (vim) follows write to a new file (.swp, .tmp ..)
and move it to actual file name later. There is a window, where we will
encounter one case that the file data is not flushed to the disk, so in
another process(here) when reading it will be empty.

Let just wait and try again.

Signed-off-by: Xiubo Li xiubli@redhat.com

… out

In-case if the editor (vim) follows write to a new file (.swp, .tmp ..)
and move it to actual file name later. There is a window, where we will
encounter one case that the file data is not flushed to the disk, so in
another process(here) when reading it will be empty.

Let just wait and try again.

Signed-off-by: Xiubo Li <xiubli@redhat.com>

buf = malloc(TCMU_MAX_CFG_FILE_SIZE);
if (!buf)
return -ENOMEM;

retry:
count++;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tabbing/spacing got messed up for the count++ line.

*/
if (count <= 5 && (len == 0 || ret == -ENOENT)) {
tcmu_dbg("failed to read the config from file, retrying (%d/5) times\n",
count);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the "count);" line here. I think the tabbing/spacing got messed up.

@lxbsz lxbsz changed the base branch from master to main August 10, 2022 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants