From patchwork Wed May 29 17:43:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10967411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A591933 for ; Wed, 29 May 2019 17:43:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C10A28A4E for ; Wed, 29 May 2019 17:43:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 602E828A48; Wed, 29 May 2019 17:43:45 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 092E728936 for ; Wed, 29 May 2019 17:43:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727344AbfE2Rno (ORCPT ); Wed, 29 May 2019 13:43:44 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:53585 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727233AbfE2Rnn (ORCPT ); Wed, 29 May 2019 13:43:43 -0400 Received: by mail-wm1-f68.google.com with SMTP id d17so2249085wmb.3; Wed, 29 May 2019 10:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mWDe89ODCpcP6HYYy/yqf+cljHqldogh+/AgsrEHfwE=; b=cD+1CJrnj5cSe1wCIpAFwua2MN1kN1xNg3hIT6ATRPZEleePpBS6eGUWulB1qlMP1/ Ddr+gyrC56II0jJ0mgCgLIHbYpIvw9Uaoe35riq+AN93RuLHGQu72fjZVk3oqne9Wl+a sFfqjNZWNIrSKacCT5jz5DzGMxohKbXopTtjeRxkeMfIWjQJexxCmL17wfht1kbQ0/kE u1NOszql8jNhqMOcQO8sYBy9Q68Pnu+PhxaKS7z/iWim9WlT01meShp9XkP3LSxieuyg pHfItlQiK/im4jO8Ue5CcjCo4tKicYkzQVAcyZ97HWBzBCNCpfC50cefJIS6Q8wCnxh8 9bOw== 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=mWDe89ODCpcP6HYYy/yqf+cljHqldogh+/AgsrEHfwE=; b=aFtoHqoN44phN5OJUAEr2WAo7OkNAP780VnpnjkvMHeYFjTTb+cTVbTuN+P1JL7jKh ADPl5+01G+LAFREY6BCx5to2IX4shbif/lVhD4LErFp09acqMEzndnK+7lOCNTcI/MHc /12TEdkMXmCEgsxrezvy82Csqv7NrVwNL4s8qagbuxjwOSv/30C29S7mh6YaXyc7o3l7 9lPV04LbECoP3neMVcrE80H++955zwVsGri57Rgi8NAg8iyhA32fY6JgAZRKMxPPtl5Z j392EDX4j4jxu4RWQPde1oL/VpKaW8cb35kpEZz7YJWT1Jr1dagrbWep99Rr43dkQDK4 feGQ== X-Gm-Message-State: APjAAAVtaPJkmcaQSEeerfPgN3eKU6EbN8T1pTBWZ7uJQro55q01FjLZ wX23RNxRfkwr0wOkxoDWKC0= X-Google-Smtp-Source: APXvYqwIlp98ADVdrSYvWbdeg9HNHHdS9VwKtmNUodON5E/WEaVY9+Ztcp9OWHWCflaplsQIscHC1A== X-Received: by 2002:a1c:cb49:: with SMTP id b70mr8135774wmg.80.1559151821622; Wed, 29 May 2019 10:43:41 -0700 (PDT) Received: from localhost.localdomain ([5.102.238.208]) by smtp.gmail.com with ESMTPSA id k125sm31702wmb.34.2019.05.29.10.43.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 May 2019 10:43:41 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Christoph Hellwig , linux-xfs@vger.kernel.org, Olga Kornievskaia , Luis Henriques , Al Viro , linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, ceph-devel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org Subject: [PATCH v3 07/13] xfs: use file_modified() helper Date: Wed, 29 May 2019 20:43:11 +0300 Message-Id: <20190529174318.22424-8-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190529174318.22424-1-amir73il@gmail.com> References: <20190529174318.22424-1-amir73il@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Note that by using the helper, the order of calling file_remove_privs() after file_update_mtime() in xfs_file_aio_write_checks() has changed. Signed-off-by: Amir Goldstein Reviewed-by: Darrick J. Wong --- fs/xfs/xfs_file.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 76748255f843..916a35cae5e9 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -367,20 +367,7 @@ xfs_file_aio_write_checks( * lock above. Eventually we should look into a way to avoid * the pointless lock roundtrip. */ - if (likely(!(file->f_mode & FMODE_NOCMTIME))) { - error = file_update_time(file); - if (error) - return error; - } - - /* - * If we're writing the file then make sure to clear the setuid and - * setgid bits if the process is not being run by root. This keeps - * people from modifying setuid and setgid binaries. - */ - if (!IS_NOSEC(inode)) - return file_remove_privs(file); - return 0; + return file_modified(file); } static int