NFS: commit direct writes even if they fail partially
commit60af9d47409cc57fd61b13a95de27981abfa773c
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 16 Jan 2018 15:08:00 +0000 (16 10:08 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2018 19:06:46 +0000 (16 20:06 +0100)
treec2fcfa1e62b0540ccf7a3d0b13ae3e8bf248da3d
parent6d301c957fafe2bdc59c75efb56ea663b7cdab4c
NFS: commit direct writes even if they fail partially

commit 1b8d97b0a837beaf48a8449955b52c650a7114b4 upstream.

If some of the WRITE calls making up an O_DIRECT write syscall fail,
we neglect to commit, even if some of the WRITEs succeed.

We also depend on the commit code to free the reference count on the
nfs_page taken in the "if (request_commit)" case at the end of
nfs_direct_write_completion().  The problem was originally noticed
because ENOSPC's encountered partway through a write would result in a
closed file being sillyrenamed when it should have been unlinked.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/direct.c