Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp78426ybh; Fri, 6 Mar 2020 16:25:35 -0800 (PST) X-Google-Smtp-Source: ADFU+vu7a4occ7fcBznnrGPS4CohhB7NLmaUYfEBdnYmdrxg7Qw5IwWbeqOfrNE7CzpMwOy4x+dE X-Received: by 2002:a9d:3de4:: with SMTP id l91mr4833588otc.35.1583540735181; Fri, 06 Mar 2020 16:25:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583540735; cv=none; d=google.com; s=arc-20160816; b=uRpqMmbus7gWt6B28rw+QbqiRuKW/M++jRGr1LWep2KN+wcXoTlke1/brXM4bAQcWS Y9vlEvmAhgERK611BPA8jMcWS8JOg15fYeqIb5+xvuHipXuHpODwZAy4WFoYhUEIqArb BJ3m9gQXt9hRPW3E8Qw28IUc73UC7FoVb1Y6hrANvtYUHCEv9dUdPm5LKSInHlROvPp4 bAqOGQGIlLuUcRpOzdzpeFR9NOIxeDrJPfS+re7NHqiQMfenAo/Ntlg4dRfNGGq5Vctl dWy9cThfktU/vn9BOPTFRaIQQBedVNpZr334a0psSpsNgWL3bjs7nusl9j72Ie3C+tGc rNZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JePsOinuyqrfoBOxQwjLOgF0L/X0Fljm69rhHZAecFc=; b=SDDYOUZquL/E/srgrgjSsfnSh9jd4pcYNRoxdOKiJVCl8VlC1V4mY3KKFfOEbIm0ch d+jerMgqHl28GjY3fbAKbaoUMqmvoz2tXNNeDKFxRYWpm5D9Hyu5k/H+Oq0B/KNDFSmP sMb5cW10410bsDp032SMWkmkCvWn2fAYO/HjrY6jjwgLcBHQ0L0c34LLJb7/Nhbx+V0D o6TLsNiuezpgIKpxkYkOKkYXbRrnWDkikAkoOJFs03+S43IGfwDp7iqHX4k4BbIm0d/b ic/VRs+d0/2rzNcxNZosbR5JkxIqFQCUumt56zirJRm3RDJ6Cbb6qcqYKCxhe8kwK8Zb uRwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tpSqdkzj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x189si526219oia.270.2020.03.06.16.25.23; Fri, 06 Mar 2020 16:25:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tpSqdkzj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726676AbgCGAYl (ORCPT + 99 others); Fri, 6 Mar 2020 19:24:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:59696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726368AbgCGAYl (ORCPT ); Fri, 6 Mar 2020 19:24:41 -0500 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 901C0206E2; Sat, 7 Mar 2020 00:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583540680; bh=B72rG1jwLbG2y/Xk21RtChGVMs08LLX26UA7wxJK7XI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tpSqdkzjbvlHV87zP5VZdFv9lE0mA/6eQJkWRgcGgYArXxTgvSeCyV8Z8vgOiD8Ku 91oZt4IM9h1yIscyunfSHVvMeIaPPVyKpdb/Rv1cNXPvtx77nBUxiEHWy/UCmZ5nLp E1SSOAedqG+uu7BrqfC++0gy/ad+A7ngWYpF2or8= Date: Fri, 6 Mar 2020 16:24:40 -0800 From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Daniel Rosenberg , kernel-team@android.com Subject: Re: [PATCH v2] f2fs: fix wrong check on F2FS_IOC_FSSETXATTR Message-ID: <20200307002440.GA7944@google.com> References: <20200305234822.178708-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200305234822.178708-1-jaegeuk@kernel.org> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This fixes the incorrect failure when enabling project quota on casefold-enabled file. Cc: Daniel Rosenberg Cc: kernel-team@android.com Signed-off-by: Jaegeuk Kim --- log from v1: - fix the last check fs/f2fs/file.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index b443dc2947c7..07f636732199 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1794,12 +1794,15 @@ 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 masked_flags = fi->i_flags & mask; + + f2fs_bug_on(F2FS_I_SB(inode), (iflags & ~mask)); /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) return -EPERM; - if ((iflags ^ fi->i_flags) & F2FS_CASEFOLD_FL) { + if ((iflags ^ masked_flags) & F2FS_CASEFOLD_FL) { if (!f2fs_sb_has_casefold(F2FS_I_SB(inode))) return -EOPNOTSUPP; if (!f2fs_empty_dir(inode)) @@ -1813,9 +1816,9 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) return -EINVAL; } - if ((iflags ^ fi->i_flags) & F2FS_COMPR_FL) { + if ((iflags ^ masked_flags) & F2FS_COMPR_FL) { if (S_ISREG(inode->i_mode) && - (fi->i_flags & F2FS_COMPR_FL || i_size_read(inode) || + (masked_flags & F2FS_COMPR_FL || i_size_read(inode) || F2FS_HAS_BLOCKS(inode))) return -EINVAL; if (iflags & F2FS_NOCOMP_FL) @@ -1832,8 +1835,8 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) set_compress_context(inode); } } - if ((iflags ^ fi->i_flags) & F2FS_NOCOMP_FL) { - if (fi->i_flags & F2FS_COMPR_FL) + if ((iflags ^ masked_flags) & F2FS_NOCOMP_FL) { + if (masked_flags & F2FS_COMPR_FL) return -EINVAL; } -- 2.25.1.481.gfbce0eb801-goog