From patchwork Mon May 7 08:37:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10383437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C26976037F for ; Mon, 7 May 2018 08:38:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B63E4288E5 for ; Mon, 7 May 2018 08:38:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB12128A96; Mon, 7 May 2018 08:38:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53B30288E5 for ; Mon, 7 May 2018 08:38:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbeEGIig (ORCPT ); Mon, 7 May 2018 04:38:36 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36902 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752114AbeEGIiY (ORCPT ); Mon, 7 May 2018 04:38:24 -0400 Received: by mail-wm0-f67.google.com with SMTP id l1-v6so13847539wmb.2 for ; Mon, 07 May 2018 01:38:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=akjp4HmhVaO9blh1QR/ndToq9TEu0xVehImZbvHkhc0=; b=KX/pw2I7Nr81ahJD4AOFfiEmyuYyre/737iz2qvkxzkB1vNmG0PnHZh1NgyTY8TdQM D+L+5BFiipqJXv7U+tFJlQu2TMA0BiihC+Qx695jS1k2WXRLhftfHoiEUDRZlZeZJ75u 1fMdlHYAD/0Xycqr5q0MjQqItxrvVHptRifrEIfL4sD4yYKGMzP/CDTslvl0zvu8yVOg fY1OyyEiIHGZFPwpfjZ7MHGqrQRepeV6n1dtVdLv5aAf5z/IQWM0lQdaZ9DFbkhwO4F/ HUTk5Cnxi+/RUi/UznzLnDzPAoalJ94Mu3BiUaYUzm6q7RSWrcVvz9KFP7ngdwVSeYsj w6SQ== X-Gm-Message-State: ALKqPwejWqHRQAKY+DFnDrOJKJBvXgN6/FfwdxAHF8wA+y2YFegbKKgY goDoqAIwTCBmuHL68AB6c/gAUQ== X-Google-Smtp-Source: AB8JxZo+r7FOjTG7WHZ9/D9v4S5To5LLMx3hEnHDJBFbgSraGbQoBE2qJ3EUAm/kDYFwbCtu8FvKBQ== X-Received: by 10.28.140.207 with SMTP id o198mr189683wmd.82.1525682303652; Mon, 07 May 2018 01:38:23 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (C2B0E321.catv.pool.telekom.hu. [194.176.227.33]) by smtp.gmail.com with ESMTPSA id h8-v6sm5908050wmc.16.2018.05.07.01.38.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 01:38:23 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/35] ovl: copy up file size as well Date: Mon, 7 May 2018 10:37:41 +0200 Message-Id: <20180507083807.28792-10-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180507083807.28792-1-mszeredi@redhat.com> References: <20180507083807.28792-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- fs/overlayfs/inode.c | 9 --------- fs/overlayfs/overlayfs.h | 2 ++ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index f7b1910bb9d4..ba3f832cc39a 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -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; diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index 4e26778774c3..b9f7c632ab9c 100644 --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h @@ -9,6 +9,7 @@ #include #include +#include #include "ovl_entry.h" enum ovl_path_type { @@ -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)