From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 163AAC5B578 for ; Mon, 1 Jul 2019 20:27:14 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E323320B7C; Mon, 1 Jul 2019 20:27:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="TJ3BtsyJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="mcHKQgpB"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="JPUIMVpM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E323320B7C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1hi2tE-000413-Nl; Mon, 01 Jul 2019 20:27:04 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1hi2tB-00040c-Iw for linux-f2fs-devel@lists.sourceforge.net; Mon, 01 Jul 2019 20:27:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4UyunLJH8W03sO9mLqXejosf+oxVWrjHBsH8h7Yf1Os=; b=TJ3BtsyJSEQpnsuJSOXdhqlgy8 a0tgI8lRJ7/BcQVkyFgSx75X5sBIgZ5FoRVp+mIhjFYwH53UIU0qpziixErDFQA6jZfxsjp98UIP1 AOLhBiXvU53XdEE8PTimrg4Kpm6igc1SSJeJ8lHYD8WWajATEy19NvnefBUjpuigKFkU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4UyunLJH8W03sO9mLqXejosf+oxVWrjHBsH8h7Yf1Os=; b=mcHKQgpBogu2fLcr4BjeLwZpfr Qe+i7uzpGbmbZNvT4PbRTyPzIB1WtEmeaAJ4FzepS+LIp+VnND1Sv0CFMf8r1rb00Dq4db3uqkr2B n/veGx5ptYKV1ODG8fcncltewX9YpU2fWlJnWgLL7BgHzjJWHiGLJlIUDOH28c4M6JYA=; Received: from [198.145.29.99] (helo=mail.kernel.org) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hi2tE-003mbI-2c for linux-f2fs-devel@lists.sourceforge.net; Mon, 01 Jul 2019 20:27:05 +0000 Received: from ebiggers-linuxstation.mtv.corp.google.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6BD621841; Mon, 1 Jul 2019 20:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562012809; bh=fH1qBz8bc9aMV/qeircw6YrBU3Zw3ZRFu8JyT+UZkO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPUIMVpM68daxj+LoCTaRcevYYhGNPlgAi5g0Bq52xfRB2hM168VM074YtK0J50mJ k73xI0YrsY0ompp9Zk/pCtCeNflGCwtz0ye/4oqgPG0HKb/s6bhHyhutEfqCLFhRwj TkeivbS+6hH90iOoYJ/Tp7zrixjaRy6ujstcFHFg= From: Eric Biggers To: "Darrick J . Wong" Date: Mon, 1 Jul 2019 13:26:30 -0700 Message-Id: <20190701202630.43776-4-ebiggers@kernel.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190701202630.43776-1-ebiggers@kernel.org> References: <20190701202630.43776-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Headers-End: 1hi2tE-003mbI-2c Subject: [f2fs-dev] [PATCH 3/3] f2fs: remove redundant check from f2fs_setflags_common() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, Jaegeuk Kim , linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Eric Biggers Now that f2fs_ioc_setflags() and f2fs_ioc_fssetxattr() call the VFS helper functions which check for permission to change the immutable and append-only flags, it's no longer needed to do this check in f2fs_setflags_common() too. So remove it. This is based on a patch from Darrick Wong, but reworked to apply after commit 360985573b55 ("f2fs: separate f2fs i_flags from fs_flags and ext4 i_flags"). Originally-from: Darrick J. Wong Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index ae1a54ecc9fccc..e8b81f6f5c2b15 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1648,19 +1648,12 @@ static int f2fs_file_flush(struct file *file, fl_owner_t id) static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) { struct f2fs_inode_info *fi = F2FS_I(inode); - u32 oldflags; /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) return -EPERM; - oldflags = fi->i_flags; - - if ((iflags ^ oldflags) & (F2FS_APPEND_FL | F2FS_IMMUTABLE_FL)) - if (!capable(CAP_LINUX_IMMUTABLE)) - return -EPERM; - - fi->i_flags = iflags | (oldflags & ~mask); + fi->i_flags = iflags | (fi->i_flags & ~mask); if (fi->i_flags & F2FS_PROJINHERIT_FL) set_inode_flag(inode, FI_PROJ_INHERIT); -- 2.22.0.410.gd8fdbe21b5-goog _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel