NFS client/buffer cache deadlock

Brian Fundakowski Feldman green at freebsd.org
Tue Apr 26 08:50:45 PDT 2005


On Tue, Apr 26, 2005 at 05:17:51PM +0200, Marc Olzheim wrote:
> On Tue, Apr 26, 2005 at 10:07:01AM -0400, Brian Fundakowski Feldman wrote:
> > > Could someone from standards comment here ? I believe Garrett is
> > > right...
> > > (thread is on -hackers and -current)
> > 
> > What prevents you from using O_FSYNC | O_APPEND to get the
> > functionality you desire?  The semantics of IO_UNIT -- atomic writes
> > -- are definitely defined and assumed to function properly by the rest
> > of the kernel.  Allowing asynchronous unbounded atomic appends is
> > impossible, so something must be done to prevent deadlock.  Breaking
> > IO_UNIT really shouldn't be considered as a solution.  Automatically
> > turning the write into a synchronous + atomic append if an asynchrous
> > + atomic append is not possible might follow POLA best.
> 
> I don't care whether a user application corrupts it's own data by
> writing simultaneously to the same file from different hosts; that's the
> choice of the application. What I want is when the application behaves
> and is the only one writing to the file, that that writev() succeeds.
> 
> I'm okay with the fact that simultaneous huge writes to the same file
> over NFS could lead to corruption and that the exact outcome is
> undefined.
> 
> This is exactly how it was in FreeBSD 4.x and that's perfectly workable.
> 
> But that's just my way of looking at it and certainly not ideal. :-/

I don't know what you mean.  The exact same bug should exists in 4.x,
and should cause a system deadlock in exactly the same scenario.
Simultaneous huge writes for NFSv3 were and still are atomic and I
do not intend to break that -- just make it so they won't deadlock
the system.  I'm not okay with making applications suddenly start
corrupting data.

Why can't you use O_FSYNC for your huge writes?  I'm willing to bet
that its semantics are exactly what you're looking for.

-- 
Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green at FreeBSD.org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\


More information about the freebsd-standards mailing list