aboutsummaryrefslogtreecommitdiffstats
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-04 22:36:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-04 22:36:06 -0400
commit1dc51b8288007753ad7cd7d08bb8fa930fc8bb10 (patch)
tree0616c0ff7d877e64d9c248a6cdff074eae258840 /fs/overlayfs
parent9b284cbdb5de3b8871014f8290d1b540e5181c21 (diff)
parent0f1db7dee200127da4c07928189748918c312031 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro: "Assorted VFS fixes and related cleanups (IMO the most interesting in that part are f_path-related things and Eric's descriptor-related stuff). UFS regression fixes (it got broken last cycle). 9P fixes. fs-cache series, DAX patches, Jan's file_remove_suid() work" [ I'd say this is much more than "fixes and related cleanups". The file_table locking rule change by Eric Dumazet is a rather big and fundamental update even if the patch isn't huge. - Linus ] * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (49 commits) 9p: cope with bogus responses from server in p9_client_{read,write} p9_client_write(): avoid double p9_free_req() 9p: forgetting to cancel request on interrupted zero-copy RPC dax: bdev_direct_access() may sleep block: Add support for DAX reads/writes to block devices dax: Use copy_from_iter_nocache dax: Add block size note to documentation fs/file.c: __fget() and dup2() atomicity rules fs/file.c: don't acquire files->file_lock in fd_install() fs:super:get_anon_bdev: fix race condition could cause dev exceed its upper limitation vfs: avoid creation of inode number 0 in get_next_ino namei: make set_root_rcu() return void make simple_positive() public ufs: use dir_pages instead of ufs_dir_pages() pagemap.h: move dir_pages() over there remove the pointless include of lglock.h fs: cleanup slight list_entry abuse xfs: Correctly lock inode when removing suid and file capabilities fs: Call security_ops->inode_killpriv on truncate fs: Provide function telling whether file_remove_privs() will do anything ...
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/inode.c22
-rw-r--r--fs/overlayfs/overlayfs.h1
-rw-r--r--fs/overlayfs/super.c1
3 files changed, 9 insertions, 15 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 308379b2d0b2..f140e3dbfb7b 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -337,37 +337,30 @@ static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type,
337 return true; 337 return true;
338} 338}
339 339
340static int ovl_dentry_open(struct dentry *dentry, struct file *file, 340struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags)
341 const struct cred *cred)
342{ 341{
343 int err; 342 int err;
344 struct path realpath; 343 struct path realpath;
345 enum ovl_path_type type; 344 enum ovl_path_type type;
346 bool want_write = false;
347 345
348 type = ovl_path_real(dentry, &realpath); 346 type = ovl_path_real(dentry, &realpath);
349 if (ovl_open_need_copy_up(file->f_flags, type, realpath.dentry)) { 347 if (ovl_open_need_copy_up(file_flags, type, realpath.dentry)) {
350 want_write = true;
351 err = ovl_want_write(dentry); 348 err = ovl_want_write(dentry);
352 if (err) 349 if (err)
353 goto out; 350 return ERR_PTR(err);
354 351
355 if (file->f_flags & O_TRUNC) 352 if (file_flags & O_TRUNC)
356 err = ovl_copy_up_last(dentry, NULL, true); 353 err = ovl_copy_up_last(dentry, NULL, true);
357 else 354 else
358 err = ovl_copy_up(dentry); 355 err = ovl_copy_up(dentry);
356 ovl_drop_write(dentry);
359 if (err) 357 if (err)
360 goto out_drop_write; 358 return ERR_PTR(err);
361 359
362 ovl_path_upper(dentry, &realpath); 360 ovl_path_upper(dentry, &realpath);
363 } 361 }
364 362
365 err = vfs_open(&realpath, file, cred); 363 return d_backing_inode(realpath.dentry);
366out_drop_write:
367 if (want_write)
368 ovl_drop_write(dentry);
369out:
370 return err;
371} 364}
372 365
373static const struct inode_operations ovl_file_inode_operations = { 366static const struct inode_operations ovl_file_inode_operations = {
@@ -378,7 +371,6 @@ static const struct inode_operations ovl_file_inode_operations = {
378 .getxattr = ovl_getxattr, 371 .getxattr = ovl_getxattr,
379 .listxattr = ovl_listxattr, 372 .listxattr = ovl_listxattr,
380 .removexattr = ovl_removexattr, 373 .removexattr = ovl_removexattr,
381 .dentry_open = ovl_dentry_open,
382}; 374};
383 375
384static const struct inode_operations ovl_symlink_inode_operations = { 376static const struct inode_operations ovl_symlink_inode_operations = {
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 17ac5afc9ffb..ea5a40b06e3a 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -173,6 +173,7 @@ ssize_t ovl_getxattr(struct dentry *dentry, const char *name,
173 void *value, size_t size); 173 void *value, size_t size);
174ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); 174ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
175int ovl_removexattr(struct dentry *dentry, const char *name); 175int ovl_removexattr(struct dentry *dentry, const char *name);
176struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags);
176 177
177struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, 178struct inode *ovl_new_inode(struct super_block *sb, umode_t mode,
178 struct ovl_entry *oe); 179 struct ovl_entry *oe);
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 8a08c582bc22..7466ff339c66 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -316,6 +316,7 @@ static int ovl_dentry_weak_revalidate(struct dentry *dentry, unsigned int flags)
316 316
317static const struct dentry_operations ovl_dentry_operations = { 317static const struct dentry_operations ovl_dentry_operations = {
318 .d_release = ovl_dentry_release, 318 .d_release = ovl_dentry_release,
319 .d_select_inode = ovl_d_select_inode,
319}; 320};
320 321
321static const struct dentry_operations ovl_reval_dentry_operations = { 322static const struct dentry_operations ovl_reval_dentry_operations = {