aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 12:10:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 12:10:19 -0400
commit790eac5640abf7a57fa3a644386df330e18c11b0 (patch)
tree08de20bde44f59e51b91ff473a71047c2957e8c9 /mm
parent0b0585c3e192967cb2ef0ac0816eb8a8c8d99840 (diff)
parent48bde8d3620f5f3c6ae9ff599eb404055ae51664 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull second set of VFS changes from Al Viro: "Assorted f_pos race fixes, making do_splice_direct() safe to call with i_mutex on parent, O_TMPFILE support, Jeff's locks.c series, ->d_hash/->d_compare calling conventions changes from Linus, misc stuff all over the place." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits) Document ->tmpfile() ext4: ->tmpfile() support vfs: export lseek_execute() to modules lseek_execute() doesn't need an inode passed to it block_dev: switch to fixed_size_llseek() cpqphp_sysfs: switch to fixed_size_llseek() tile-srom: switch to fixed_size_llseek() proc_powerpc: switch to fixed_size_llseek() ubi/cdev: switch to fixed_size_llseek() pci/proc: switch to fixed_size_llseek() isapnp: switch to fixed_size_llseek() lpfc: switch to fixed_size_llseek() locks: give the blocked_hash its own spinlock locks: add a new "lm_owner_key" lock operation locks: turn the blocked_list into a hashtable locks: convert fl_link to a hlist_node locks: avoid taking global lock if possible when waking up blocked waiters locks: protect most of the file_lock handling with i_lock locks: encapsulate the fl_link list handling locks: make "added" in __posix_lock_file a bool ...
Diffstat (limited to 'mm')
-rw-r--r--mm/shmem.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 5e6a8422658b..118dfa4952f4 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1798,10 +1798,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence)
1798 } 1798 }
1799 } 1799 }
1800 1800
1801 if (offset >= 0 && offset != file->f_pos) { 1801 offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE);
1802 file->f_pos = offset;
1803 file->f_version = 0;
1804 }
1805 mutex_unlock(&inode->i_mutex); 1802 mutex_unlock(&inode->i_mutex);
1806 return offset; 1803 return offset;
1807} 1804}
@@ -1965,6 +1962,37 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
1965 return error; 1962 return error;
1966} 1963}
1967 1964
1965static int
1966shmem_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
1967{
1968 struct inode *inode;
1969 int error = -ENOSPC;
1970
1971 inode = shmem_get_inode(dir->i_sb, dir, mode, 0, VM_NORESERVE);
1972 if (inode) {
1973 error = security_inode_init_security(inode, dir,
1974 NULL,
1975 shmem_initxattrs, NULL);
1976 if (error) {
1977 if (error != -EOPNOTSUPP) {
1978 iput(inode);
1979 return error;
1980 }
1981 }
1982#ifdef CONFIG_TMPFS_POSIX_ACL
1983 error = generic_acl_init(inode, dir);
1984 if (error) {
1985 iput(inode);
1986 return error;
1987 }
1988#else
1989 error = 0;
1990#endif
1991 d_tmpfile(dentry, inode);
1992 }
1993 return error;
1994}
1995
1968static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) 1996static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1969{ 1997{
1970 int error; 1998 int error;
@@ -2723,6 +2751,7 @@ static const struct inode_operations shmem_dir_inode_operations = {
2723 .rmdir = shmem_rmdir, 2751 .rmdir = shmem_rmdir,
2724 .mknod = shmem_mknod, 2752 .mknod = shmem_mknod,
2725 .rename = shmem_rename, 2753 .rename = shmem_rename,
2754 .tmpfile = shmem_tmpfile,
2726#endif 2755#endif
2727#ifdef CONFIG_TMPFS_XATTR 2756#ifdef CONFIG_TMPFS_XATTR
2728 .setxattr = shmem_setxattr, 2757 .setxattr = shmem_setxattr,