On Tue, Jun 05, 2018 at 02:10:24PM +0200, David Sterba wrote: > On Mon, Jun 04, 2018 at 09:31:16PM +0200, Andreas Gruenbacher wrote: > > @@ -1062,8 +1063,9 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, > > if (ret < 0) > > iomap_dio_set_error(dio, ret); > > > > + smp_mb__before_atomic(); > > if (!atomic_dec_and_test(&dio->ref)) { > > The barrier should be documented. I tried to do a quick look around the > code if it's clear why it's there but it's not. Thanks. It doesn't really make sense. smp_mb__before_atomic is for relaxed atomic operations, which atomic_dec_and_test is not.