Samba with XFS and atomic read/write guaranty

Amir Goldstein amir73il at
Mon Mar 25 13:12:14 UTC 2019

Hi Volker,

As we discussed offline, we have been observing > 200ms
latencies on read/write operations when running a random
read/write workload on single file over samba on an xfs filesystem.
[aio read size = 1; aio write size = 1; aio max threads = 32]
These latencies are not observed when running the same workload
over samba with ext4 filesystem.

I finally got around to investigating the difference between xfs
and ext4. The results of my investigation are unfolding in this
fsdevel thread:

It turns out that xfs respects POSIX w.r.t "atomic read/write" and
this is implemented by taking a file-wide shared lock on every
buffered read.
This behavior is unique to XFS on Linux and is not optional.
Other Linux filesystems only guaranty page level atomicity for
buffered read/write.

I have proposed to make the xfs "atomic buffered read/write"
behavior optional and will see how that proposal plays out, but
in the mean while, could you say if SMB has a requirement for
atomic read/write and/or if samba handles the serialization
for read/write to overlapping file areas itself?

To put it another way, to the best of your knowledge, does the
fact that ext4 does not guaranty atomic read/write (for entire IO
buffer) or the fact that xfs might loose this guaranty have any
negative affect on samba users?


More information about the samba-technical mailing list