ftruncate an overlayfs inode was checking IS_APPEND() on overlay inode, but overlay inode does not have the S_APPEND flag. Set 'inode' var to file_inode() so all checks are performed on the real inode and use the overlay inode/sb explicitly for freeze protection and file lock checks. Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- fs/open.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/open.c b/fs/open.c index 949cef2..b7d5ab1 100644 --- a/fs/open.c +++ b/fs/open.c @@ -182,7 +182,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) small = 0; dentry = f.file->f_path.dentry; - inode = dentry->d_inode; + inode = file_inode(f.file); error = -EINVAL; if (!S_ISREG(inode->i_mode) || !(f.file->f_mode & FMODE_WRITE)) goto out_putf; @@ -196,13 +196,13 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) if (IS_APPEND(inode)) goto out_putf; - sb_start_write(inode->i_sb); - error = locks_verify_truncate(inode, f.file, length); + sb_start_write(dentry->d_sb); + error = locks_verify_truncate(d_inode(dentry), f.file, length); if (!error) error = security_path_truncate(&f.file->f_path); if (!error) error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, f.file); - sb_end_write(inode->i_sb); + sb_end_write(dentry->d_sb); out_putf: fdput(f); out: -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html