From patchwork Tue May 29 14:46:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10435771 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 9285F602BF for ; Tue, 29 May 2018 14:49:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83F652860C for ; Tue, 29 May 2018 14:49:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 787A628653; Tue, 29 May 2018 14:49:57 +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=unavailable 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 2561F2860C for ; Tue, 29 May 2018 14:49:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936448AbeE2OsX (ORCPT ); Tue, 29 May 2018 10:48:23 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:37830 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936689AbeE2Oqt (ORCPT ); Tue, 29 May 2018 10:46:49 -0400 Received: by mail-wr0-f196.google.com with SMTP id i12-v6so26016043wrc.4 for ; Tue, 29 May 2018 07:46:48 -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=xGo7eNmKjZvUsnw/kUnOZF2NEEXkV+721D6Zyf0WakQ=; b=mG/CgWo+7jKaJPpA4K3zNvqZUCGl62dz6d1jENaXIj05KgF2g66hziuX3GxnanQjtd kd8Hi7GmNeX5rjxNIsxXoEwpOiUsLGppMgY30paZFgw4rzVva4nZrsbH4iwuFcNNiPEB l9Uw2dVoahrJTZt3ju/8kuEuLo4RbDkcyUdxOf7amTUn+4gFZ3ZxXYqtTOoaJbtc0Zf3 aYxaiIuV0tqVEwhKR6UR+MTZUmRTec1fCVPNzLOOz91Ww4wanikwFe4S/JnTtQrafK50 cACd5W4m0oriRCchI44u80+NboTDtqoYy9BbdNoex3+wOu3vXqNpHiXuypp1wsLs6Ebc qEAg== X-Gm-Message-State: ALKqPwf5QI99UGnEmcQjUM6/ipNXoqydOtiqBWdPXLS7L5Khkon/Hu2y sDkNnC9oKG3rrMm5tU04ks8YeQ== X-Google-Smtp-Source: AB8JxZpqNei6NQq/s5iGJxvLSwxeK7MK6MhjVFVZ6u2z6eigBQlrFjrWgZoPpuRTHMbEMoXub8Of3w== X-Received: by 2002:adf:a6f8:: with SMTP id t111-v6mr13447867wrc.161.1527605208307; Tue, 29 May 2018 07:46:48 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-176-63-54-97.catv.broadband.hu. [176.63.54.97]) by smtp.gmail.com with ESMTPSA id n71-v6sm20942227wmi.14.2018.05.29.07.46.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 07:46:47 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 27/28] ovl: Do not do metacopy only for ioctl modifying file attr Date: Tue, 29 May 2018 16:46:11 +0200 Message-Id: <20180529144612.16675-28-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180529144612.16675-1-mszeredi@redhat.com> References: <20180529144612.16675-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 From: Vivek Goyal ovl_copy_up() by default will only do metadata only copy up (if enabled). That means when ovl_real_ioctl() calls ovl_real_file(), it will still get the lower file (as ovl_real_file() opens data file and not metacopy). And that means "chattr +i" will end up modifying lower inode. There seem to be two ways to solve this. A. Open metacopy file in ovl_real_ioctl() and do operations on that B. Force full copy up when FS_IOC_SETFLAGS is called. I am resorting to option B for now as it feels little safer option. If there are performance issues due to this, we can revisit it. Signed-off-by: Vivek Goyal Reviewed-by: Amir Goldstein Signed-off-by: Miklos Szeredi --- fs/overlayfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 953295774471..31f32fc1004b 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -389,7 +389,7 @@ static long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (ret) return ret; - ret = ovl_copy_up(file_dentry(file)); + ret = ovl_copy_up_with_data(file_dentry(file)); if (!ret) { ret = ovl_real_ioctl(file, cmd, arg);