]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFS: Add attribute update barriers to nfs_setattr_update_inode()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 26 Feb 2015 21:09:04 +0000 (16:09 -0500)
committerJiri Slaby <jslaby@suse.cz>
Thu, 9 Apr 2015 12:13:22 +0000 (14:13 +0200)
commitdb9e4643a103945a7ce6880f14b751845e0eb988
tree47552c67b8aca37b0d964f1d2c8ad59b8074a45f
parentace3fc1e3f3a85ec705805146247231b11e1babe
NFS: Add attribute update barriers to nfs_setattr_update_inode()

commit f044636d972246d451e06226cc1675d5da389762 upstream.

Ensure that other operations which raced with our setattr RPC call
cannot revert the file attribute changes that were made on the server.
To do so, we artificially bump the attribute generation counter on
the inode so that all calls to nfs_fattr_init() that precede ours
will be dropped.

The motivation for the patch came from Chuck Lever's reports of readaheads
racing with truncate operations and causing the file size to be reverted.

Reported-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Tested-by: Chuck Lever <chuck.lever@oracle.com>
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/nfs/inode.c
fs/nfs/nfs3proc.c
fs/nfs/nfs4proc.c
fs/nfs/proc.c
include/linux/nfs_fs.h