diff options
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r-- | fs/ceph/inode.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 04c89c266cec..7b6139004401 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -766,7 +766,7 @@ static int fill_inode(struct inode *inode, | |||
766 | 766 | ||
767 | /* xattrs */ | 767 | /* xattrs */ |
768 | /* note that if i_xattrs.len <= 4, i_xattrs.data will still be NULL. */ | 768 | /* note that if i_xattrs.len <= 4, i_xattrs.data will still be NULL. */ |
769 | if ((issued & CEPH_CAP_XATTR_EXCL) == 0 && | 769 | if ((ci->i_xattrs.version == 0 || !(issued & CEPH_CAP_XATTR_EXCL)) && |
770 | le64_to_cpu(info->xattr_version) > ci->i_xattrs.version) { | 770 | le64_to_cpu(info->xattr_version) > ci->i_xattrs.version) { |
771 | if (ci->i_xattrs.blob) | 771 | if (ci->i_xattrs.blob) |
772 | ceph_buffer_put(ci->i_xattrs.blob); | 772 | ceph_buffer_put(ci->i_xattrs.blob); |
@@ -1813,10 +1813,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1813 | if (ia_valid & ATTR_SIZE) { | 1813 | if (ia_valid & ATTR_SIZE) { |
1814 | dout("setattr %p size %lld -> %lld\n", inode, | 1814 | dout("setattr %p size %lld -> %lld\n", inode, |
1815 | inode->i_size, attr->ia_size); | 1815 | inode->i_size, attr->ia_size); |
1816 | if (attr->ia_size > inode->i_sb->s_maxbytes) { | ||
1817 | err = -EINVAL; | ||
1818 | goto out; | ||
1819 | } | ||
1820 | if ((issued & CEPH_CAP_FILE_EXCL) && | 1816 | if ((issued & CEPH_CAP_FILE_EXCL) && |
1821 | attr->ia_size > inode->i_size) { | 1817 | attr->ia_size > inode->i_size) { |
1822 | inode->i_size = attr->ia_size; | 1818 | inode->i_size = attr->ia_size; |
@@ -1896,8 +1892,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1896 | if (mask & CEPH_SETATTR_SIZE) | 1892 | if (mask & CEPH_SETATTR_SIZE) |
1897 | __ceph_do_pending_vmtruncate(inode); | 1893 | __ceph_do_pending_vmtruncate(inode); |
1898 | return err; | 1894 | return err; |
1899 | out: | ||
1900 | spin_unlock(&ci->i_ceph_lock); | ||
1901 | out_put: | 1895 | out_put: |
1902 | ceph_mdsc_put_request(req); | 1896 | ceph_mdsc_put_request(req); |
1903 | return err; | 1897 | return err; |
@@ -1907,7 +1901,7 @@ out_put: | |||
1907 | * Verify that we have a lease on the given mask. If not, | 1901 | * Verify that we have a lease on the given mask. If not, |
1908 | * do a getattr against an mds. | 1902 | * do a getattr against an mds. |
1909 | */ | 1903 | */ |
1910 | int ceph_do_getattr(struct inode *inode, int mask) | 1904 | int ceph_do_getattr(struct inode *inode, int mask, bool force) |
1911 | { | 1905 | { |
1912 | struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb); | 1906 | struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb); |
1913 | struct ceph_mds_client *mdsc = fsc->mdsc; | 1907 | struct ceph_mds_client *mdsc = fsc->mdsc; |
@@ -1920,7 +1914,7 @@ int ceph_do_getattr(struct inode *inode, int mask) | |||
1920 | } | 1914 | } |
1921 | 1915 | ||
1922 | dout("do_getattr inode %p mask %s mode 0%o\n", inode, ceph_cap_string(mask), inode->i_mode); | 1916 | dout("do_getattr inode %p mask %s mode 0%o\n", inode, ceph_cap_string(mask), inode->i_mode); |
1923 | if (ceph_caps_issued_mask(ceph_inode(inode), mask, 1)) | 1917 | if (!force && ceph_caps_issued_mask(ceph_inode(inode), mask, 1)) |
1924 | return 0; | 1918 | return 0; |
1925 | 1919 | ||
1926 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_GETATTR, USE_ANY_MDS); | 1920 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_GETATTR, USE_ANY_MDS); |
@@ -1948,7 +1942,7 @@ int ceph_permission(struct inode *inode, int mask) | |||
1948 | if (mask & MAY_NOT_BLOCK) | 1942 | if (mask & MAY_NOT_BLOCK) |
1949 | return -ECHILD; | 1943 | return -ECHILD; |
1950 | 1944 | ||
1951 | err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED); | 1945 | err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED, false); |
1952 | 1946 | ||
1953 | if (!err) | 1947 | if (!err) |
1954 | err = generic_permission(inode, mask); | 1948 | err = generic_permission(inode, mask); |
@@ -1966,7 +1960,7 @@ int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1966 | struct ceph_inode_info *ci = ceph_inode(inode); | 1960 | struct ceph_inode_info *ci = ceph_inode(inode); |
1967 | int err; | 1961 | int err; |
1968 | 1962 | ||
1969 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL); | 1963 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL, false); |
1970 | if (!err) { | 1964 | if (!err) { |
1971 | generic_fillattr(inode, stat); | 1965 | generic_fillattr(inode, stat); |
1972 | stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino); | 1966 | stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino); |