Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'hotfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6

* 'hotfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
NFS: nfs_updatepage(): don't mark page as dirty if an error occurred
NFS: Fix filehandle size comparisons in the mount code
NFS: Reduce the NFS mount code stack usage.

+51 -37
+3 -2
fs/nfs/mount_clnt.c
··· 130 struct mnt_fhstatus *res) 131 { 132 struct nfs_fh *fh = res->fh; 133 134 if ((res->status = ntohl(*p++)) == 0) { 135 - int size = ntohl(*p++); 136 - if (size <= NFS3_FHSIZE) { 137 fh->size = size; 138 memcpy(fh->data, p, size); 139 } else
··· 130 struct mnt_fhstatus *res) 131 { 132 struct nfs_fh *fh = res->fh; 133 + unsigned size; 134 135 if ((res->status = ntohl(*p++)) == 0) { 136 + size = ntohl(*p++); 137 + if (size <= NFS3_FHSIZE && size != 0) { 138 fh->size = size; 139 memcpy(fh->data, p, size); 140 } else
+44 -32
fs/nfs/super.c
··· 1216 { 1217 struct nfs_mount_data *data = (struct nfs_mount_data *)options; 1218 1219 - memset(args, 0, sizeof(*args)); 1220 - 1221 if (data == NULL) 1222 goto out_no_data; 1223 ··· 1249 case 5: 1250 memset(data->context, 0, sizeof(data->context)); 1251 case 6: 1252 - if (data->flags & NFS_MOUNT_VER3) 1253 mntfh->size = data->root.size; 1254 - else 1255 mntfh->size = NFS2_FHSIZE; 1256 1257 - if (mntfh->size > sizeof(mntfh->data)) 1258 - goto out_invalid_fh; 1259 1260 memcpy(mntfh->data, data->root.data, mntfh->size); 1261 if (mntfh->size < sizeof(mntfh->data)) ··· 1583 { 1584 struct nfs_server *server = NULL; 1585 struct super_block *s; 1586 - struct nfs_fh mntfh; 1587 - struct nfs_parsed_mount_data data; 1588 struct dentry *mntroot; 1589 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1590 struct nfs_sb_mountdata sb_mntdata = { 1591 .mntflags = flags, 1592 }; 1593 - int error; 1594 1595 - security_init_mnt_opts(&data.lsm_opts); 1596 1597 /* Validate the mount data */ 1598 - error = nfs_validate_mount_data(raw_data, &data, &mntfh, dev_name); 1599 if (error < 0) 1600 goto out; 1601 1602 /* Get a volume representation */ 1603 - server = nfs_create_server(&data, &mntfh); 1604 if (IS_ERR(server)) { 1605 error = PTR_ERR(server); 1606 goto out; ··· 1633 1634 if (!s->s_root) { 1635 /* initial superblock/root creation */ 1636 - nfs_fill_super(s, &data); 1637 } 1638 1639 - mntroot = nfs_get_root(s, &mntfh); 1640 if (IS_ERR(mntroot)) { 1641 error = PTR_ERR(mntroot); 1642 goto error_splat_super; 1643 } 1644 1645 - error = security_sb_set_mnt_opts(s, &data.lsm_opts); 1646 if (error) 1647 goto error_splat_root; 1648 ··· 1652 error = 0; 1653 1654 out: 1655 - kfree(data.nfs_server.hostname); 1656 - kfree(data.mount_server.hostname); 1657 - security_free_mnt_opts(&data.lsm_opts); 1658 return error; 1659 1660 out_err_nosb: ··· 1805 struct sockaddr_in *ap; 1806 struct nfs4_mount_data *data = (struct nfs4_mount_data *)options; 1807 char *c; 1808 - 1809 - memset(args, 0, sizeof(*args)); 1810 1811 if (data == NULL) 1812 goto out_no_data; ··· 1963 static int nfs4_get_sb(struct file_system_type *fs_type, 1964 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) 1965 { 1966 - struct nfs_parsed_mount_data data; 1967 struct super_block *s; 1968 struct nfs_server *server; 1969 - struct nfs_fh mntfh; 1970 struct dentry *mntroot; 1971 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1972 struct nfs_sb_mountdata sb_mntdata = { 1973 .mntflags = flags, 1974 }; 1975 - int error; 1976 1977 - security_init_mnt_opts(&data.lsm_opts); 1978 1979 /* Validate the mount data */ 1980 - error = nfs4_validate_mount_data(raw_data, &data, dev_name); 1981 if (error < 0) 1982 goto out; 1983 1984 /* Get a volume representation */ 1985 - server = nfs4_create_server(&data, &mntfh); 1986 if (IS_ERR(server)) { 1987 error = PTR_ERR(server); 1988 goto out; ··· 2018 nfs4_fill_super(s); 2019 } 2020 2021 - mntroot = nfs4_get_root(s, &mntfh); 2022 if (IS_ERR(mntroot)) { 2023 error = PTR_ERR(mntroot); 2024 goto error_splat_super; 2025 } 2026 2027 - error = security_sb_set_mnt_opts(s, &data.lsm_opts); 2028 if (error) 2029 goto error_splat_root; 2030 ··· 2034 error = 0; 2035 2036 out: 2037 - kfree(data.client_address); 2038 - kfree(data.nfs_server.export_path); 2039 - kfree(data.nfs_server.hostname); 2040 - security_free_mnt_opts(&data.lsm_opts); 2041 return error; 2042 2043 out_free:
··· 1216 { 1217 struct nfs_mount_data *data = (struct nfs_mount_data *)options; 1218 1219 if (data == NULL) 1220 goto out_no_data; 1221 ··· 1251 case 5: 1252 memset(data->context, 0, sizeof(data->context)); 1253 case 6: 1254 + if (data->flags & NFS_MOUNT_VER3) { 1255 + if (data->root.size > NFS3_FHSIZE || data->root.size == 0) 1256 + goto out_invalid_fh; 1257 mntfh->size = data->root.size; 1258 + } else 1259 mntfh->size = NFS2_FHSIZE; 1260 1261 1262 memcpy(mntfh->data, data->root.data, mntfh->size); 1263 if (mntfh->size < sizeof(mntfh->data)) ··· 1585 { 1586 struct nfs_server *server = NULL; 1587 struct super_block *s; 1588 + struct nfs_parsed_mount_data *data; 1589 + struct nfs_fh *mntfh; 1590 struct dentry *mntroot; 1591 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1592 struct nfs_sb_mountdata sb_mntdata = { 1593 .mntflags = flags, 1594 }; 1595 + int error = -ENOMEM; 1596 1597 + data = kzalloc(sizeof(*data), GFP_KERNEL); 1598 + mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); 1599 + if (data == NULL || mntfh == NULL) 1600 + goto out_free_fh; 1601 + 1602 + security_init_mnt_opts(&data->lsm_opts); 1603 1604 /* Validate the mount data */ 1605 + error = nfs_validate_mount_data(raw_data, data, mntfh, dev_name); 1606 if (error < 0) 1607 goto out; 1608 1609 /* Get a volume representation */ 1610 + server = nfs_create_server(data, mntfh); 1611 if (IS_ERR(server)) { 1612 error = PTR_ERR(server); 1613 goto out; ··· 1630 1631 if (!s->s_root) { 1632 /* initial superblock/root creation */ 1633 + nfs_fill_super(s, data); 1634 } 1635 1636 + mntroot = nfs_get_root(s, mntfh); 1637 if (IS_ERR(mntroot)) { 1638 error = PTR_ERR(mntroot); 1639 goto error_splat_super; 1640 } 1641 1642 + error = security_sb_set_mnt_opts(s, &data->lsm_opts); 1643 if (error) 1644 goto error_splat_root; 1645 ··· 1649 error = 0; 1650 1651 out: 1652 + kfree(data->nfs_server.hostname); 1653 + kfree(data->mount_server.hostname); 1654 + security_free_mnt_opts(&data->lsm_opts); 1655 + out_free_fh: 1656 + kfree(mntfh); 1657 + kfree(data); 1658 return error; 1659 1660 out_err_nosb: ··· 1799 struct sockaddr_in *ap; 1800 struct nfs4_mount_data *data = (struct nfs4_mount_data *)options; 1801 char *c; 1802 1803 if (data == NULL) 1804 goto out_no_data; ··· 1959 static int nfs4_get_sb(struct file_system_type *fs_type, 1960 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) 1961 { 1962 + struct nfs_parsed_mount_data *data; 1963 struct super_block *s; 1964 struct nfs_server *server; 1965 + struct nfs_fh *mntfh; 1966 struct dentry *mntroot; 1967 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1968 struct nfs_sb_mountdata sb_mntdata = { 1969 .mntflags = flags, 1970 }; 1971 + int error = -ENOMEM; 1972 1973 + data = kzalloc(sizeof(*data), GFP_KERNEL); 1974 + mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); 1975 + if (data == NULL || mntfh == NULL) 1976 + goto out_free_fh; 1977 + 1978 + security_init_mnt_opts(&data->lsm_opts); 1979 1980 /* Validate the mount data */ 1981 + error = nfs4_validate_mount_data(raw_data, data, dev_name); 1982 if (error < 0) 1983 goto out; 1984 1985 /* Get a volume representation */ 1986 + server = nfs4_create_server(data, mntfh); 1987 if (IS_ERR(server)) { 1988 error = PTR_ERR(server); 1989 goto out; ··· 2009 nfs4_fill_super(s); 2010 } 2011 2012 + mntroot = nfs4_get_root(s, mntfh); 2013 if (IS_ERR(mntroot)) { 2014 error = PTR_ERR(mntroot); 2015 goto error_splat_super; 2016 } 2017 2018 + error = security_sb_set_mnt_opts(s, &data->lsm_opts); 2019 if (error) 2020 goto error_splat_root; 2021 ··· 2025 error = 0; 2026 2027 out: 2028 + kfree(data->client_address); 2029 + kfree(data->nfs_server.export_path); 2030 + kfree(data->nfs_server.hostname); 2031 + security_free_mnt_opts(&data->lsm_opts); 2032 + out_free_fh: 2033 + kfree(mntfh); 2034 + kfree(data); 2035 return error; 2036 2037 out_free:
+4 -3
fs/nfs/write.c
··· 739 } 740 741 status = nfs_writepage_setup(ctx, page, offset, count); 742 - __set_page_dirty_nobuffers(page); 743 744 dprintk("NFS: nfs_updatepage returns %d (isize %Ld)\n", 745 status, (long long)i_size_read(inode)); 746 - if (status < 0) 747 - nfs_set_pageerror(page); 748 return status; 749 } 750
··· 739 } 740 741 status = nfs_writepage_setup(ctx, page, offset, count); 742 + if (status < 0) 743 + nfs_set_pageerror(page); 744 + else 745 + __set_page_dirty_nobuffers(page); 746 747 dprintk("NFS: nfs_updatepage returns %d (isize %Ld)\n", 748 status, (long long)i_size_read(inode)); 749 return status; 750 } 751