Is Samba sync or async for writes?

Being sync or async for data writing of a file system or a network file system affects the data integrity. Is Samba sync or async for writes?

asked Jun 19, 2017 by anonymous

1 Answer

In summary, Samba writes are async by default. But the behavior is configurable.

Here is a great summary by Eric Roseme.

Samba defaults to asynchronous writes. smbd writes to memory buffer,
then returns to processing. Buffer is flushed to disk later. This is
the most efficient behavior.

Windows CreateFile API has the FILE_FLAG_WRITE_THROUGH flag, which
requests synchronous writes. smbd writes to memory buffer, blocks
until buffer contents are written to disk, which results in poor
performance, but better data integrity.

When "strict sync = yes" (default = no) Samba honors the
FILE_FLAG_WRITE_THROUGH flag, and results in synchronous writes when
called by the CreateFile API.

When "sync always = yes" (default = no) Samba executes all writes
synchronously. This requires that “strict sync = yes”.

StrictSync  SyncAlways  ff_write_through   Sync-Writes
     no          no             no                no
     yes         no             no                no
     yes         no             yes               Yes (slow)
     no          yes            yes               no
     yes         yes            yes/no            yes (very slow)
answered Jun 25, 2017 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost