Re: dd, close(), sync, and the Linux disk cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> Can you explain further why it's necessary given that the kernel
> explicitly blocks execution of close() to flush buffers to disk,
> assuming the process is the last one with the device open? Am I
> misinterpreting the code path I mentioned later in my email? In
> practice, I can see this happening when I use dd.

>From what I could gather empirically, close() does write dirty pages
from the block device's page cache to disk but does not submit a
"flush" request to the device driver. Depending on the driver and
device, this may be necessary to ensure that data is persistently
stored (e.g., if the device features an internal write-back cache).
Performing a sync command with the block device as an argument, or
reopening the device and invoking fsync() or fdatasync(), submits
and awaits that request.

The existence or non-existence of a device-internal write-back
cache, and differences in the timing and policies of such a cache,
may explain why in some cases the sync appears necessary and in
others it doesn't.

Alberto Faria



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux