]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
nfsd: special case truncates some more
authorChristoph Hellwig <hch@lst.de>
Mon, 20 Feb 2017 06:21:33 +0000 (07:21 +0100)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 13 Mar 2017 21:20:54 +0000 (15:20 -0600)
commitcebbfc12919a24071360ddfaad4fa1257c3bbf12
tree7f93878174bd0d2dfc4252137993042e72a3a908
parentd8d5a74c4c39e31d7eba15873bc771e5532c504a
nfsd: special case truncates some more

BugLink: http://bugs.launchpad.net/bugs/1672544
commit 783112f7401ff449d979530209b3f6c2594fdb4e upstream.

Both the NFS protocols and the Linux VFS use a setattr operation with a
bitmap of attributes to set to set various file attributes including the
file size and the uid/gid.

The Linux syscalls never mix size updates with unrelated updates like
the uid/gid, and some file systems like XFS and GFS2 rely on the fact
that truncates don't update random other attributes, and many other file
systems handle the case but do not update the other attributes in the
same transaction.  NFSD on the other hand passes the attributes it gets
on the wire more or less directly through to the VFS, leading to updates
the file systems don't expect.  XFS at least has an assert on the
allowed attributes, which caught an unusual NFS client setting the size
and group at the same time.

To handle this issue properly this splits the notify_change call in
nfsd_setattr into two separate ones.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/nfsd/vfs.c