/* This is a copy of the common vmtruncate, but with the locking corrected to take into account the fact that NFS requires inode->i_size to be updated under the inode->i_lock.  */
static int nfs_vmtruncate(struct inode *inode, loff_t offset)
/* This is a copy of the common vmtruncate, but with the locking corrected to take into account the fact that NFS requires inode->i_size to be updated under the inode->i_lock.  */
static int nfs_vmtruncate(struct inode *inode, loff_t offset)
{
	loff_t oldsize;
	int err;
	err = inode_newsize_ok(inode, offset);
	if (err)
		goto out;
	spin_lock(&inode->i_lock);
	oldsize = inode->i_size;
	i_size_write(inode, offset);
	spin_unlock(&inode->i_lock);
	truncate_pagecache(inode, oldsize, offset);
out:
	return err;
}