From patchwork Wed Jan 6 21:15:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1423066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DB2Fs4C6bz9sWC; Thu, 7 Jan 2021 08:15:28 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kxG9J-0007f9-Oy; Wed, 06 Jan 2021 21:15:21 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kxG9I-0007eq-9P for kernel-team@lists.ubuntu.com; Wed, 06 Jan 2021 21:15:20 +0000 Received: from mail-ot1-f71.google.com ([209.85.210.71]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kxG9H-000126-Tu for kernel-team@lists.ubuntu.com; Wed, 06 Jan 2021 21:15:20 +0000 Received: by mail-ot1-f71.google.com with SMTP id q8so2491847otk.6 for ; Wed, 06 Jan 2021 13:15:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yUJZvPSKVIJx1XFwMmZXNTVrd+1hJPVwizKsLT84FsE=; b=sixiP+xacS0vo3c0iRza5EUAx8AV36rzKw9xMvlbalUs10BDW9xhKFdtM0Irv57jN0 B4rdCt78ouS4cRCbcbGE1Mt6G6a6wm+LHkl6nMZ9g3AMBfsSZV/MR0hcoz/UCHhsinLx a1WaHbDuDqpE07y8ygO/T9JhhoFZvQc1ljCc+XYMXuusdhQi5+n2axMNCJrKNNh4EsEx cnWZs4wfo2lTEma3ZEHH36LQOAJbgf7hp9bDNBSqwoSO+iEWNlPdQx6+z+OppM+FS4Lk G3PZUe0Wt/Ms456/YZdz9grE456i7pKZV1flwI1Fjp5Ckh066LKQxHRibqUR2fnq1iRm NpLw== X-Gm-Message-State: AOAM530KzF4BTd7Bj92wspf0xZF1Cz9NXHFNnHu/QgpScWeEV/A4rb3V i4MASL1ClSXlRoL3bFadLf5OkeSWCpa65yU/yDtB8QbzQjQlhKkvjWz6V187LcEanhmW6xa1Pf5 hC1T/Yy0CvNQlfboK3hIrhqNfYQAFEdddFx7G9f0qRA== X-Received: by 2002:aca:2403:: with SMTP id n3mr4483743oic.136.1609967718820; Wed, 06 Jan 2021 13:15:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxelJq8WzWTVy+cCo4YHRfCMJQAfWLiyuYdwA3osU+jx/L7SkRNjXKE96m5ZJzB1gT59HrPUg== X-Received: by 2002:aca:2403:: with SMTP id n3mr4483735oic.136.1609967718563; Wed, 06 Jan 2021 13:15:18 -0800 (PST) Received: from localhost ([136.37.150.243]) by smtp.gmail.com with ESMTPSA id g3sm730044ooi.28.2021.01.06.13.15.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 13:15:17 -0800 (PST) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU F/G] ovl: do not fail because of O_NOATIME Date: Wed, 6 Jan 2021 15:15:15 -0600 Message-Id: <20210106211515.80586-2-seth.forshee@canonical.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210106211515.80586-1-seth.forshee@canonical.com> References: <20210106211515.80586-1-seth.forshee@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Miklos Szeredi BugLink: https://bugs.launchpad.net/bugs/1900141 In case the file cannot be opened with O_NOATIME because of lack of capabilities, then clear O_NOATIME instead of failing. Remove WARN_ON(), since it would now trigger if O_NOATIME was cleared. Noticed by Amir Goldstein. Signed-off-by: Miklos Szeredi (backported from commit b6650dab404c701d7fe08a108b746542a934da84) Signed-off-by: Seth Forshee Acked-by: Thadeu Lima de Souza Cascardo --- fs/overlayfs/file.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 87a399b74f69..0d3ea0cf3e98 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -43,9 +43,10 @@ static struct file *ovl_open_realfile(const struct file *file, err = inode_permission(realinode, MAY_OPEN | acc_mode); if (err) { realfile = ERR_PTR(err); - } else if (!inode_owner_or_capable(realinode)) { - realfile = ERR_PTR(-EPERM); } else { + if (!inode_owner_or_capable(realinode)) + flags &= ~O_NOATIME; + ovl_path_real(file->f_path.dentry, &realpath); realfile = open_with_fake_path(&realpath, flags, realinode, current_cred()); @@ -66,12 +67,6 @@ static int ovl_change_flags(struct file *file, unsigned int flags) struct inode *inode = file_inode(file); int err; - flags |= OVL_OPEN_FLAGS; - - /* If some flag changed that cannot be changed then something's amiss */ - if (WARN_ON((file->f_flags ^ flags) & ~OVL_SETFL_MASK)) - return -EIO; - flags &= OVL_SETFL_MASK; if (((flags ^ file->f_flags) & O_APPEND) && IS_APPEND(inode))