|
@@ -507,10 +507,15 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
|
|
attr->ia_valid &= ~ATTR_MODE;
|
|
attr->ia_valid &= ~ATTR_MODE;
|
|
|
|
|
|
if (attr->ia_valid & ATTR_SIZE) {
|
|
if (attr->ia_valid & ATTR_SIZE) {
|
|
|
|
+ loff_t i_size;
|
|
|
|
+
|
|
BUG_ON(!S_ISREG(inode->i_mode));
|
|
BUG_ON(!S_ISREG(inode->i_mode));
|
|
|
|
|
|
- if (attr->ia_size == i_size_read(inode))
|
|
|
|
|
|
+ i_size = i_size_read(inode);
|
|
|
|
+ if (attr->ia_size == i_size)
|
|
attr->ia_valid &= ~ATTR_SIZE;
|
|
attr->ia_valid &= ~ATTR_SIZE;
|
|
|
|
+ else if (attr->ia_size < i_size && IS_SWAPFILE(inode))
|
|
|
|
+ return -ETXTBSY;
|
|
}
|
|
}
|
|
|
|
|
|
/* Optimization: if the end result is no change, don't RPC */
|
|
/* Optimization: if the end result is no change, don't RPC */
|