From patchwork Sun Jan 31 13:21:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 8174351 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF9F29F38B for ; Sun, 31 Jan 2016 13:21:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 26D2620320 for ; Sun, 31 Jan 2016 13:21:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 49870202FE for ; Sun, 31 Jan 2016 13:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757361AbcAaNVg (ORCPT ); Sun, 31 Jan 2016 08:21:36 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:36237 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757319AbcAaNVf (ORCPT ); Sun, 31 Jan 2016 08:21:35 -0500 Received: by mail-lf0-f41.google.com with SMTP id 78so32693731lfy.3; Sun, 31 Jan 2016 05:21:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=7lNIT6cklEeHQObI13GKQorO0axUkCUlG7MUXRPNpLE=; b=n0TYMafqjwOl43txpPWWLvYv64Q6Rwzb0WOBkA4jy5yM0QbDqQGThASJ9guTHO6IWA 3T6EHIarlBcWZGCiRvELpbYJRotoQApjF4ZragHiqAjSZu9H+oDLdEGevCzbbI9fj7W4 63XA5Xr7k4xVnqIE+7X7qikmFunt3AUz6FaQrclcVKgSa/vYjo5f1TId/kJKEeZcyavO ddWRIlg9ebkxn1Jj/FMbPzYE3oWeXGuJd1DPWrC+S77KMuUISt6Xyh92uBdJMkHekTtb RzB1WoSkN96fsIahuzKu4/aJNHTDPhzx9wGLlZtUdC1bqWQbLi2Aw106P2gIwG6Te7op rOBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=7lNIT6cklEeHQObI13GKQorO0axUkCUlG7MUXRPNpLE=; b=JtU0cIXt87sZ6akgqQmVxB6hgDojDbjFwyMTzCQBnT80NaJxHrVkxxvNAJse8nUgLd 2rGEH66cpXk4qk7DzNBypUo01MvVG85Acd5xYXHxo7O3BZWjwIeuhudGBBaqMki7HNTr vCbgEhWR9vGb6pQVAhJOlZIRrRod4oXRTS5blpU9ndSomzUZzzqrWNfiWh3uNca3Z29i o+i+Z3u8lTO7crwwAVHgikzfWiUQGkbwJdkIBIq1YTg6FqaETOR0tRDnEK7V8HUmrfpp TffHLuh8ZOz8tuYbkToMe5ye7QYZQcesPK0oePe041PkcYCWiQjX2YFKp9BST3D323Ze ri9g== X-Gm-Message-State: AG10YOQcV30k+K3EsH6xvfhVemrJxBDbjklJXY9XcCZ72Hp9XQG6Y/Q23PIsJNqhk89PNQ== X-Received: by 10.25.136.84 with SMTP id k81mr7114280lfd.78.1454246493392; Sun, 31 Jan 2016 05:21:33 -0800 (PST) Received: from localhost (ppp79-139-147-94.pppoe.spdop.ru. [79.139.147.94]) by smtp.gmail.com with ESMTPSA id l129sm3290811lfl.37.2016.01.31.05.21.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 Jan 2016 05:21:32 -0800 (PST) Subject: [PATCH] ovl: copy new uid/gid into overlayfs runtime inode From: Konstantin Khlebnikov To: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, Miklos Szeredi Cc: linux-kernel@vger.kernel.org, Alexander Viro Date: Sun, 31 Jan 2016 16:21:29 +0300 Message-ID: <145424648900.10573.4331586687947621230.stgit@zurg> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Overlayfs must update uid/gid after chown, otherwise functions like inode_owner_or_capable() will check user against stale uid. Catched by xfstests generic/087, it chowns file and calls utimes. Signed-off-by: Konstantin Khlebnikov --- fs/overlayfs/inode.c | 2 ++ 1 file changed, 2 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 49e204560655..a4ff5d0d7db9 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -65,6 +65,8 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr) inode_lock(upperdentry->d_inode); err = notify_change(upperdentry, attr, NULL); + if (!err) + ovl_copyattr(upperdentry->d_inode, dentry->d_inode); inode_unlock(upperdentry->d_inode); } ovl_drop_write(dentry);