diff options
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 4845911f1c63..bb7ca022bcb2 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -814,28 +814,39 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
814 | nfs_wb_all(inode); | 814 | nfs_wb_all(inode); |
815 | } | 815 | } |
816 | error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr); | 816 | error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr); |
817 | if (error == 0) { | 817 | if (error == 0) |
818 | nfs_refresh_inode(inode, &fattr); | 818 | nfs_refresh_inode(inode, &fattr); |
819 | nfs_end_data_update(inode); | ||
820 | unlock_kernel(); | ||
821 | return error; | ||
822 | } | ||
823 | |||
824 | /** | ||
825 | * nfs_setattr_update_inode - Update inode metadata after a setattr call. | ||
826 | * @inode: pointer to struct inode | ||
827 | * @attr: pointer to struct iattr | ||
828 | * | ||
829 | * Note: we do this in the *proc.c in order to ensure that | ||
830 | * it works for things like exclusive creates too. | ||
831 | */ | ||
832 | void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr) | ||
833 | { | ||
834 | if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) { | ||
819 | if ((attr->ia_valid & ATTR_MODE) != 0) { | 835 | if ((attr->ia_valid & ATTR_MODE) != 0) { |
820 | int mode; | 836 | int mode = attr->ia_mode & S_IALLUGO; |
821 | mode = inode->i_mode & ~S_IALLUGO; | 837 | mode |= inode->i_mode & ~S_IALLUGO; |
822 | mode |= attr->ia_mode & S_IALLUGO; | ||
823 | inode->i_mode = mode; | 838 | inode->i_mode = mode; |
824 | } | 839 | } |
825 | if ((attr->ia_valid & ATTR_UID) != 0) | 840 | if ((attr->ia_valid & ATTR_UID) != 0) |
826 | inode->i_uid = attr->ia_uid; | 841 | inode->i_uid = attr->ia_uid; |
827 | if ((attr->ia_valid & ATTR_GID) != 0) | 842 | if ((attr->ia_valid & ATTR_GID) != 0) |
828 | inode->i_gid = attr->ia_gid; | 843 | inode->i_gid = attr->ia_gid; |
829 | if ((attr->ia_valid & ATTR_SIZE) != 0) { | ||
830 | inode->i_size = attr->ia_size; | ||
831 | vmtruncate(inode, attr->ia_size); | ||
832 | } | ||
833 | } | ||
834 | if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) | ||
835 | NFS_FLAGS(inode) |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | 844 | NFS_FLAGS(inode) |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; |
836 | nfs_end_data_update(inode); | 845 | } |
837 | unlock_kernel(); | 846 | if ((attr->ia_valid & ATTR_SIZE) != 0) { |
838 | return error; | 847 | inode->i_size = attr->ia_size; |
848 | vmtruncate(inode, attr->ia_size); | ||
849 | } | ||
839 | } | 850 | } |
840 | 851 | ||
841 | /* | 852 | /* |