diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-22 20:42:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-22 20:42:14 -0500 |
commit | be5e6616dd74e17fdd8e16ca015cfef94d49b467 (patch) | |
tree | a18826e557f0d6636f1e05a4ec30d584ed981a2b /arch/s390 | |
parent | 90c453ca2214394eec602d98e6cb92d151908493 (diff) | |
parent | 0a280962dc6e117e0e4baa668453f753579265d9 (diff) |
Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro:
"Assorted stuff from this cycle. The big ones here are multilayer
overlayfs from Miklos and beginning of sorting ->d_inode accesses out
from David"
* 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (51 commits)
autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
procfs: fix race between symlink removals and traversals
debugfs: leave freeing a symlink body until inode eviction
Documentation/filesystems/Locking: ->get_sb() is long gone
trylock_super(): replacement for grab_super_passive()
fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
SELinux: Use d_is_positive() rather than testing dentry->d_inode
Smack: Use d_is_positive() rather than testing dentry->d_inode
TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode
Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb
VFS: Split DCACHE_FILE_TYPE into regular and special types
VFS: Add a fallthrough flag for marking virtual dentries
VFS: Add a whiteout dentry type
VFS: Introduce inode-getting helpers for layered/unioned fs environments
Infiniband: Fix potential NULL d_inode dereference
posix_acl: fix reference leaks in posix_acl_create
autofs4: Wrong format for printing dentry
...
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/hypfs/inode.c | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 4c8008dd938e..99824ff8dd35 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c | |||
@@ -74,7 +74,7 @@ static void hypfs_remove(struct dentry *dentry) | |||
74 | parent = dentry->d_parent; | 74 | parent = dentry->d_parent; |
75 | mutex_lock(&parent->d_inode->i_mutex); | 75 | mutex_lock(&parent->d_inode->i_mutex); |
76 | if (hypfs_positive(dentry)) { | 76 | if (hypfs_positive(dentry)) { |
77 | if (S_ISDIR(dentry->d_inode->i_mode)) | 77 | if (d_is_dir(dentry)) |
78 | simple_rmdir(parent->d_inode, dentry); | 78 | simple_rmdir(parent->d_inode, dentry); |
79 | else | 79 | else |
80 | simple_unlink(parent->d_inode, dentry); | 80 | simple_unlink(parent->d_inode, dentry); |
@@ -144,36 +144,32 @@ static int hypfs_open(struct inode *inode, struct file *filp) | |||
144 | return nonseekable_open(inode, filp); | 144 | return nonseekable_open(inode, filp); |
145 | } | 145 | } |
146 | 146 | ||
147 | static ssize_t hypfs_aio_read(struct kiocb *iocb, const struct iovec *iov, | 147 | static ssize_t hypfs_read_iter(struct kiocb *iocb, struct iov_iter *to) |
148 | unsigned long nr_segs, loff_t offset) | ||
149 | { | 148 | { |
150 | char *data; | 149 | struct file *file = iocb->ki_filp; |
151 | ssize_t ret; | 150 | char *data = file->private_data; |
152 | struct file *filp = iocb->ki_filp; | 151 | size_t available = strlen(data); |
153 | /* XXX: temporary */ | 152 | loff_t pos = iocb->ki_pos; |
154 | char __user *buf = iov[0].iov_base; | 153 | size_t count; |
155 | size_t count = iov[0].iov_len; | ||
156 | |||
157 | if (nr_segs != 1) | ||
158 | return -EINVAL; | ||
159 | |||
160 | data = filp->private_data; | ||
161 | ret = simple_read_from_buffer(buf, count, &offset, data, strlen(data)); | ||
162 | if (ret <= 0) | ||
163 | return ret; | ||
164 | 154 | ||
165 | iocb->ki_pos += ret; | 155 | if (pos < 0) |
166 | file_accessed(filp); | 156 | return -EINVAL; |
167 | 157 | if (pos >= available || !iov_iter_count(to)) | |
168 | return ret; | 158 | return 0; |
159 | count = copy_to_iter(data + pos, available - pos, to); | ||
160 | if (!count) | ||
161 | return -EFAULT; | ||
162 | iocb->ki_pos = pos + count; | ||
163 | file_accessed(file); | ||
164 | return count; | ||
169 | } | 165 | } |
170 | static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov, | 166 | |
171 | unsigned long nr_segs, loff_t offset) | 167 | static ssize_t hypfs_write_iter(struct kiocb *iocb, struct iov_iter *from) |
172 | { | 168 | { |
173 | int rc; | 169 | int rc; |
174 | struct super_block *sb = file_inode(iocb->ki_filp)->i_sb; | 170 | struct super_block *sb = file_inode(iocb->ki_filp)->i_sb; |
175 | struct hypfs_sb_info *fs_info = sb->s_fs_info; | 171 | struct hypfs_sb_info *fs_info = sb->s_fs_info; |
176 | size_t count = iov_length(iov, nr_segs); | 172 | size_t count = iov_iter_count(from); |
177 | 173 | ||
178 | /* | 174 | /* |
179 | * Currently we only allow one update per second for two reasons: | 175 | * Currently we only allow one update per second for two reasons: |
@@ -202,6 +198,7 @@ static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
202 | } | 198 | } |
203 | hypfs_update_update(sb); | 199 | hypfs_update_update(sb); |
204 | rc = count; | 200 | rc = count; |
201 | iov_iter_advance(from, count); | ||
205 | out: | 202 | out: |
206 | mutex_unlock(&fs_info->lock); | 203 | mutex_unlock(&fs_info->lock); |
207 | return rc; | 204 | return rc; |
@@ -440,10 +437,10 @@ struct dentry *hypfs_create_str(struct dentry *dir, | |||
440 | static const struct file_operations hypfs_file_ops = { | 437 | static const struct file_operations hypfs_file_ops = { |
441 | .open = hypfs_open, | 438 | .open = hypfs_open, |
442 | .release = hypfs_release, | 439 | .release = hypfs_release, |
443 | .read = do_sync_read, | 440 | .read = new_sync_read, |
444 | .write = do_sync_write, | 441 | .write = new_sync_write, |
445 | .aio_read = hypfs_aio_read, | 442 | .read_iter = hypfs_read_iter, |
446 | .aio_write = hypfs_aio_write, | 443 | .write_iter = hypfs_write_iter, |
447 | .llseek = no_llseek, | 444 | .llseek = no_llseek, |
448 | }; | 445 | }; |
449 | 446 | ||