aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 11:38:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 11:38:04 -0500
commitbf3d846b783327359ddc4bd4f52627b36abb4d1d (patch)
treec6b8fddbf04a2962dfcf9f487af25033f11b10b9 /mm
parent54c0a4b46150db1571d955d598cd342c9f1d9657 (diff)
parentf6500801522c61782d4990fa1ad96154cb397cd4 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "Assorted stuff; the biggest pile here is Christoph's ACL series. Plus assorted cleanups and fixes all over the place... There will be another pile later this week" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (43 commits) __dentry_path() fixes vfs: Remove second variable named error in __dentry_path vfs: Is mounted should be testing mnt_ns for NULL or error. Fix race when checking i_size on direct i/o read hfsplus: remove can_set_xattr nfsd: use get_acl and ->set_acl fs: remove generic_acl nfs: use generic posix ACL infrastructure for v3 Posix ACLs gfs2: use generic posix ACL infrastructure jfs: use generic posix ACL infrastructure xfs: use generic posix ACL infrastructure reiserfs: use generic posix ACL infrastructure ocfs2: use generic posix ACL infrastructure jffs2: use generic posix ACL infrastructure hfsplus: use generic posix ACL infrastructure f2fs: use generic posix ACL infrastructure ext2/3/4: use generic posix ACL infrastructure btrfs: use generic posix ACL infrastructure fs: make posix_acl_create more useful fs: make posix_acl_chmod more useful ...
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c42
-rw-r--r--mm/shmem.c57
2 files changed, 43 insertions, 56 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 7a7f3e0db738..d56d3c145b9f 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1428,30 +1428,28 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
1428 if (!count) 1428 if (!count)
1429 goto out; /* skip atime */ 1429 goto out; /* skip atime */
1430 size = i_size_read(inode); 1430 size = i_size_read(inode);
1431 if (pos < size) { 1431 retval = filemap_write_and_wait_range(mapping, pos,
1432 retval = filemap_write_and_wait_range(mapping, pos,
1433 pos + iov_length(iov, nr_segs) - 1); 1432 pos + iov_length(iov, nr_segs) - 1);
1434 if (!retval) { 1433 if (!retval) {
1435 retval = mapping->a_ops->direct_IO(READ, iocb, 1434 retval = mapping->a_ops->direct_IO(READ, iocb,
1436 iov, pos, nr_segs); 1435 iov, pos, nr_segs);
1437 } 1436 }
1438 if (retval > 0) { 1437 if (retval > 0) {
1439 *ppos = pos + retval; 1438 *ppos = pos + retval;
1440 count -= retval; 1439 count -= retval;
1441 } 1440 }
1442 1441
1443 /* 1442 /*
1444 * Btrfs can have a short DIO read if we encounter 1443 * Btrfs can have a short DIO read if we encounter
1445 * compressed extents, so if there was an error, or if 1444 * compressed extents, so if there was an error, or if
1446 * we've already read everything we wanted to, or if 1445 * we've already read everything we wanted to, or if
1447 * there was a short read because we hit EOF, go ahead 1446 * there was a short read because we hit EOF, go ahead
1448 * and return. Otherwise fallthrough to buffered io for 1447 * and return. Otherwise fallthrough to buffered io for
1449 * the rest of the read. 1448 * the rest of the read.
1450 */ 1449 */
1451 if (retval < 0 || !count || *ppos >= size) { 1450 if (retval < 0 || !count || *ppos >= size) {
1452 file_accessed(filp); 1451 file_accessed(filp);
1453 goto out; 1452 goto out;
1454 }
1455 } 1453 }
1456 } 1454 }
1457 1455
diff --git a/mm/shmem.c b/mm/shmem.c
index 8156f95ec0cf..1f18c9d0d93e 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -45,7 +45,7 @@ static struct vfsmount *shm_mnt;
45#include <linux/xattr.h> 45#include <linux/xattr.h>
46#include <linux/exportfs.h> 46#include <linux/exportfs.h>
47#include <linux/posix_acl.h> 47#include <linux/posix_acl.h>
48#include <linux/generic_acl.h> 48#include <linux/posix_acl_xattr.h>
49#include <linux/mman.h> 49#include <linux/mman.h>
50#include <linux/string.h> 50#include <linux/string.h>
51#include <linux/slab.h> 51#include <linux/slab.h>
@@ -620,10 +620,8 @@ static int shmem_setattr(struct dentry *dentry, struct iattr *attr)
620 } 620 }
621 621
622 setattr_copy(inode, attr); 622 setattr_copy(inode, attr);
623#ifdef CONFIG_TMPFS_POSIX_ACL
624 if (attr->ia_valid & ATTR_MODE) 623 if (attr->ia_valid & ATTR_MODE)
625 error = generic_acl_chmod(inode); 624 error = posix_acl_chmod(inode, inode->i_mode);
626#endif
627 return error; 625 return error;
628} 626}
629 627
@@ -1937,22 +1935,14 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
1937 1935
1938 inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE); 1936 inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE);
1939 if (inode) { 1937 if (inode) {
1940#ifdef CONFIG_TMPFS_POSIX_ACL 1938 error = simple_acl_create(dir, inode);
1941 error = generic_acl_init(inode, dir); 1939 if (error)
1942 if (error) { 1940 goto out_iput;
1943 iput(inode);
1944 return error;
1945 }
1946#endif
1947 error = security_inode_init_security(inode, dir, 1941 error = security_inode_init_security(inode, dir,
1948 &dentry->d_name, 1942 &dentry->d_name,
1949 shmem_initxattrs, NULL); 1943 shmem_initxattrs, NULL);
1950 if (error) { 1944 if (error && error != -EOPNOTSUPP)
1951 if (error != -EOPNOTSUPP) { 1945 goto out_iput;
1952 iput(inode);
1953 return error;
1954 }
1955 }
1956 1946
1957 error = 0; 1947 error = 0;
1958 dir->i_size += BOGO_DIRENT_SIZE; 1948 dir->i_size += BOGO_DIRENT_SIZE;
@@ -1961,6 +1951,9 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
1961 dget(dentry); /* Extra count - pin the dentry in core */ 1951 dget(dentry); /* Extra count - pin the dentry in core */
1962 } 1952 }
1963 return error; 1953 return error;
1954out_iput:
1955 iput(inode);
1956 return error;
1964} 1957}
1965 1958
1966static int 1959static int
@@ -1974,24 +1967,17 @@ shmem_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
1974 error = security_inode_init_security(inode, dir, 1967 error = security_inode_init_security(inode, dir,
1975 NULL, 1968 NULL,
1976 shmem_initxattrs, NULL); 1969 shmem_initxattrs, NULL);
1977 if (error) { 1970 if (error && error != -EOPNOTSUPP)
1978 if (error != -EOPNOTSUPP) { 1971 goto out_iput;
1979 iput(inode); 1972 error = simple_acl_create(dir, inode);
1980 return error; 1973 if (error)
1981 } 1974 goto out_iput;
1982 }
1983#ifdef CONFIG_TMPFS_POSIX_ACL
1984 error = generic_acl_init(inode, dir);
1985 if (error) {
1986 iput(inode);
1987 return error;
1988 }
1989#else
1990 error = 0;
1991#endif
1992 d_tmpfile(dentry, inode); 1975 d_tmpfile(dentry, inode);
1993 } 1976 }
1994 return error; 1977 return error;
1978out_iput:
1979 iput(inode);
1980 return error;
1995} 1981}
1996 1982
1997static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) 1983static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
@@ -2223,8 +2209,8 @@ static int shmem_initxattrs(struct inode *inode,
2223 2209
2224static const struct xattr_handler *shmem_xattr_handlers[] = { 2210static const struct xattr_handler *shmem_xattr_handlers[] = {
2225#ifdef CONFIG_TMPFS_POSIX_ACL 2211#ifdef CONFIG_TMPFS_POSIX_ACL
2226 &generic_acl_access_handler, 2212 &posix_acl_access_xattr_handler,
2227 &generic_acl_default_handler, 2213 &posix_acl_default_xattr_handler,
2228#endif 2214#endif
2229 NULL 2215 NULL
2230}; 2216};
@@ -2740,6 +2726,7 @@ static const struct inode_operations shmem_inode_operations = {
2740 .getxattr = shmem_getxattr, 2726 .getxattr = shmem_getxattr,
2741 .listxattr = shmem_listxattr, 2727 .listxattr = shmem_listxattr,
2742 .removexattr = shmem_removexattr, 2728 .removexattr = shmem_removexattr,
2729 .set_acl = simple_set_acl,
2743#endif 2730#endif
2744}; 2731};
2745 2732
@@ -2764,6 +2751,7 @@ static const struct inode_operations shmem_dir_inode_operations = {
2764#endif 2751#endif
2765#ifdef CONFIG_TMPFS_POSIX_ACL 2752#ifdef CONFIG_TMPFS_POSIX_ACL
2766 .setattr = shmem_setattr, 2753 .setattr = shmem_setattr,
2754 .set_acl = simple_set_acl,
2767#endif 2755#endif
2768}; 2756};
2769 2757
@@ -2776,6 +2764,7 @@ static const struct inode_operations shmem_special_inode_operations = {
2776#endif 2764#endif
2777#ifdef CONFIG_TMPFS_POSIX_ACL 2765#ifdef CONFIG_TMPFS_POSIX_ACL
2778 .setattr = shmem_setattr, 2766 .setattr = shmem_setattr,
2767 .set_acl = simple_set_acl,
2779#endif 2768#endif
2780}; 2769};
2781 2770