aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 4bffe637ea32..e4f0dcef8f54 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -352,8 +352,9 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
352 352
353 nfs_attr_check_mountpoint(sb, fattr); 353 nfs_attr_check_mountpoint(sb, fattr);
354 354
355 if (((fattr->valid & NFS_ATTR_FATTR_FILEID) == 0) && 355 if (nfs_attr_use_mounted_on_fileid(fattr))
356 !nfs_attr_use_mounted_on_fileid(fattr)) 356 fattr->fileid = fattr->mounted_on_fileid;
357 else if ((fattr->valid & NFS_ATTR_FATTR_FILEID) == 0)
357 goto out_no_inode; 358 goto out_no_inode;
358 if ((fattr->valid & NFS_ATTR_FATTR_TYPE) == 0) 359 if ((fattr->valid & NFS_ATTR_FATTR_TYPE) == 0)
359 goto out_no_inode; 360 goto out_no_inode;
@@ -387,7 +388,6 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
387 if (S_ISREG(inode->i_mode)) { 388 if (S_ISREG(inode->i_mode)) {
388 inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops; 389 inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops;
389 inode->i_data.a_ops = &nfs_file_aops; 390 inode->i_data.a_ops = &nfs_file_aops;
390 inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info;
391 } else if (S_ISDIR(inode->i_mode)) { 391 } else if (S_ISDIR(inode->i_mode)) {
392 inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->dir_inode_ops; 392 inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->dir_inode_ops;
393 inode->i_fop = &nfs_dir_operations; 393 inode->i_fop = &nfs_dir_operations;
@@ -506,10 +506,15 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
506 attr->ia_valid &= ~ATTR_MODE; 506 attr->ia_valid &= ~ATTR_MODE;
507 507
508 if (attr->ia_valid & ATTR_SIZE) { 508 if (attr->ia_valid & ATTR_SIZE) {
509 loff_t i_size;
510
509 BUG_ON(!S_ISREG(inode->i_mode)); 511 BUG_ON(!S_ISREG(inode->i_mode));
510 512
511 if (attr->ia_size == i_size_read(inode)) 513 i_size = i_size_read(inode);
514 if (attr->ia_size == i_size)
512 attr->ia_valid &= ~ATTR_SIZE; 515 attr->ia_valid &= ~ATTR_SIZE;
516 else if (attr->ia_size < i_size && IS_SWAPFILE(inode))
517 return -ETXTBSY;
513 } 518 }
514 519
515 /* Optimization: if the end result is no change, don't RPC */ 520 /* Optimization: if the end result is no change, don't RPC */