From patchwork Wed Oct 25 06:30:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 10025941 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3059960381 for ; Wed, 25 Oct 2017 06:31:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2170128AF0 for ; Wed, 25 Oct 2017 06:31:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1649328AF2; Wed, 25 Oct 2017 06:31:18 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 BEA1828AF0 for ; Wed, 25 Oct 2017 06:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932205AbdJYGbD (ORCPT ); Wed, 25 Oct 2017 02:31:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:60922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932169AbdJYGbD (ORCPT ); Wed, 25 Oct 2017 02:31:03 -0400 Received: from localhost (ip-86-49-19-81.net.upcbroadband.cz [86.49.19.81]) (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 D8B4A214DA; Wed, 25 Oct 2017 06:31:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8B4A214DA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jaegeuk@kernel.org Date: Wed, 25 Oct 2017 08:30:58 +0200 From: Jaegeuk Kim To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH 1/2] f2fs: add missing quota_initialize in f2fs_set_acl Message-ID: <20171025063058.GA99117@jaegeuk-macbookpro.roam.corp.google.com> References: <20171023221409.59148-1-jaegeuk@kernel.org> <20171025054419.GB83348@jaegeuk-macbookpro.roam.corp.google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 10/25, Chao Yu wrote: > On 2017/10/25 13:44, Jaegeuk Kim wrote: > > On 10/24, Chao Yu wrote: > >> On 2017/10/24 6:14, Jaegeuk Kim wrote: > >>> This patch adds to call quota_intialize in f2fs_set_acl. > >>> > >>> Signed-off-by: Jaegeuk Kim > >>> --- > >>> fs/f2fs/acl.c | 4 ++++ > >>> 1 file changed, 4 insertions(+) > >>> > >>> diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c > >>> index 436b3a1464d9..f6471f9d707e 100644 > >>> --- a/fs/f2fs/acl.c > >>> +++ b/fs/f2fs/acl.c > >>> @@ -209,6 +209,10 @@ static int __f2fs_set_acl(struct inode *inode, int type, > >>> int error; > >>> umode_t mode = inode->i_mode; > >>> > >>> + error = dquot_initialize(inode); > >>> + if (error) > >>> + return error; > >> > >> Could you move this to f2fs_setxattr, and also add missing dquot_initialize in > >> unlink and rename like ext4? > > > > I've checked that f2fs_unlink and f2fs_rename are calling dquot_initialize(). > > ext4_unlink: > > retval = dquot_initialize(dir); > if (retval) > return retval; > retval = dquot_initialize(d_inode(dentry)); > if (retval) > return retval; > > f2fs_unlink: > > err = dquot_initialize(dir); > if (err) > return err; > > ext4_rename > > retval = dquot_initialize(old.dir); > if (retval) > return retval; > retval = dquot_initialize(new.dir); > if (retval) > return retval; > > /* Initialize quotas before so that eventual writes go > * in separate transaction */ > if (new.inode) { > retval = dquot_initialize(new.inode); > if (retval) > return retval; > } > > f2fs_rename > > err = dquot_initialize(old_dir); > if (err) > goto out; > > err = dquot_initialize(new_dir); > if (err) > goto out; > > ext4 call one more dquot_initialize than f2fs, I didn't look into this in > detail, but it's better to check that. :) Ah, okay. :) This patch adds to call quota_intialize in f2fs_set_acl, f2fs_unlink, and f2fs_rename. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu --- fs/f2fs/namei.c | 9 +++++++++ fs/f2fs/xattr.c | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 944f7a6940b6..35d982a475b1 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -436,6 +436,9 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) return -EIO; err = dquot_initialize(dir); + if (err) + return err; + err = dquot_initialize(inode); if (err) return err; @@ -815,6 +818,12 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, if (err) goto out; + if (new_inode) { + err = dquot_initialize(new_inode); + if (err) + goto out; + } + old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page); if (!old_entry) { if (IS_ERR(old_page)) diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 147b481c6902..8801db019892 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -686,6 +686,10 @@ int f2fs_setxattr(struct inode *inode, int index, const char *name, struct f2fs_sb_info *sbi = F2FS_I_SB(inode); int err; + err = dquot_initialize(inode); + if (err) + return err; + /* this case is only from init_inode_metadata */ if (ipage) return __f2fs_setxattr(inode, index, name, value,