aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index a15b3a9bbff4..9c6a40f5cc57 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1889,18 +1889,27 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
1889 CIFS_MOUNT_MAP_SPECIAL_CHR); 1889 CIFS_MOUNT_MAP_SPECIAL_CHR);
1890 } 1890 }
1891 1891
1892 if (!rc) { 1892 if (rc)
1893 rc = inode_setattr(inode, attrs); 1893 goto out;
1894 1894
1895 /* force revalidate when any of these times are set since some 1895 if ((attrs->ia_valid & ATTR_SIZE) &&
1896 of the fs types (eg ext3, fat) do not have fine enough 1896 attrs->ia_size != i_size_read(inode)) {
1897 time granularity to match protocol, and we do not have a 1897 rc = vmtruncate(inode, attrs->ia_size);
1898 a way (yet) to query the server fs's time granularity (and 1898 if (rc)
1899 whether it rounds times down). 1899 goto out;
1900 */
1901 if (!rc && (attrs->ia_valid & (ATTR_MTIME | ATTR_CTIME)))
1902 cifsInode->time = 0;
1903 } 1900 }
1901
1902 setattr_copy(inode, attrs);
1903 mark_inode_dirty(inode);
1904
1905 /* force revalidate when any of these times are set since some
1906 of the fs types (eg ext3, fat) do not have fine enough
1907 time granularity to match protocol, and we do not have a
1908 a way (yet) to query the server fs's time granularity (and
1909 whether it rounds times down).
1910 */
1911 if (attrs->ia_valid & (ATTR_MTIME | ATTR_CTIME))
1912 cifsInode->time = 0;
1904out: 1913out:
1905 kfree(args); 1914 kfree(args);
1906 kfree(full_path); 1915 kfree(full_path);
@@ -2040,8 +2049,20 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2040 2049
2041 /* do not need local check to inode_check_ok since the server does 2050 /* do not need local check to inode_check_ok since the server does
2042 that */ 2051 that */
2043 if (!rc) 2052 if (rc)
2044 rc = inode_setattr(inode, attrs); 2053 goto cifs_setattr_exit;
2054
2055 if ((attrs->ia_valid & ATTR_SIZE) &&
2056 attrs->ia_size != i_size_read(inode)) {
2057 rc = vmtruncate(inode, attrs->ia_size);
2058 if (rc)
2059 goto cifs_setattr_exit;
2060 }
2061
2062 setattr_copy(inode, attrs);
2063 mark_inode_dirty(inode);
2064 return 0;
2065
2045cifs_setattr_exit: 2066cifs_setattr_exit:
2046 kfree(full_path); 2067 kfree(full_path);
2047 FreeXid(xid); 2068 FreeXid(xid);