Skip to content

Commit

Permalink
ovl: copy up file size as well
Browse files Browse the repository at this point in the history
Copy i_size of the underlying inode to the overlay inode in ovl_copyattr().

This is in preparation for stacking I/O operations on overlay files.

This patch shouldn't have any observable effect.

Remove stale comment from ovl_setattr() [spotted by Vivek Goyal].

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Jul 18, 2018
1 parent 5812160 commit 46e5d0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 0 additions & 9 deletions fs/overlayfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr)
struct dentry *upperdentry;
const struct cred *old_cred;

/*
* Check for permissions before trying to copy-up. This is redundant
* since it will be rechecked later by ->setattr() on upper dentry. But
* without this, copy-up can be triggered by just about anybody.
*
* We don't initialize inode->size, which just means that
* inode_newsize_ok() will always check against MAX_LFS_FILESIZE and not
* check for a swapfile (which this won't be anyway).
*/
err = setattr_prepare(dentry, attr);
if (err)
return err;
Expand Down
2 changes: 2 additions & 0 deletions fs/overlayfs/overlayfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <linux/kernel.h>
#include <linux/uuid.h>
#include <linux/fs.h>
#include "ovl_entry.h"

enum ovl_path_type {
Expand Down Expand Up @@ -348,6 +349,7 @@ static inline void ovl_copyattr(struct inode *from, struct inode *to)
to->i_atime = from->i_atime;
to->i_mtime = from->i_mtime;
to->i_ctime = from->i_ctime;
i_size_write(to, i_size_read(from));
}

static inline void ovl_copyflags(struct inode *from, struct inode *to)
Expand Down

0 comments on commit 46e5d0a

Please sign in to comment.