On Thu, May 19, 2022 at 09:26:11AM -0500, Eric Sandeen 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.
Hi Eric,
Agreed, that is no "fsync" shell command. I always felt it will be
nice to have one. May be I should open a bug for coreutils people
as RFC and ask for either fsync command or extend sync to call
fsync.
For the time being either we need to write a simple utility say
kdump_fsync and ship with kdump package. But even simpler solution
is to just use "sync -f vmcore" which will call syncfs() on filesystem
where vmcore resides.
sync -f syncs the filesystem of the target file, not just the file itself -
but that's fine. [1]
Right. That's the idea.
Thanks
Vivek
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: