On Thu, May 19, 2022 at 10:26 PM Eric Sandeen <sandeen(a)redhat.com> wrote:
On 5/19/22 8:18 AM, Vivek Goyal wrote:
>> Hi Vivek,
>>
>> Checking the kdump scripts, we have below, a separate "sync" command
>> is added after saving vmcore, so it would be good since that cover
>> all the core collectors, if we use fsync then we need to patch
>> makedumpfile and cp, maybe it is not necessary:
> Hi Dave,
>
> I am not sure why do we need to patch makdeumpfile or cp. Once core
> collector has saved the file, we can either do "sync -f vmcore" or
> "fsync vmcore". Isn't it?
I'm not aware of any "fsync" shell command, unfortunately. It'd be
nice.
Since we are programming in pure shell script, it would be strange if
we insert a c program which call fsync on vmcore specifically for the
purpose, is there any best practice on how to achieve this?
Thanks,
Tao Liu
sync -f syncs the filesystem of the target file, not just the file
itself -
but that's fine. [1]
so sync -f vmcore should be fine, will sync only the filesystem hosting vmcore,
and should return an error if it fails. [2]
-Eric
[1] syncfs() is like sync(), but synchronizes just the filesystem containing file
referred to by the open file descriptor fd.
[2] ERRORS
sync() is always successful.
syncfs() can fail for at least the following reasons: