From patchwork Wed May 31 08:14:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tahsin Erdogan X-Patchwork-Id: 9756275 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 9E44460360 for ; Wed, 31 May 2017 08:31:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D244205A8 for ; Wed, 31 May 2017 08:31:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81BBD283BD; Wed, 31 May 2017 08:31:41 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 3096E205A8 for ; Wed, 31 May 2017 08:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751163AbdEaIbj (ORCPT ); Wed, 31 May 2017 04:31:39 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:35711 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbdEaIQt (ORCPT ); Wed, 31 May 2017 04:16:49 -0400 Received: by mail-pf0-f172.google.com with SMTP id n23so7039856pfb.2 for ; Wed, 31 May 2017 01:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uZ2kJMwdLk4VknuajjnYXaysr32vhEZVF4WMuApqNbo=; b=NZw9GEFGntuQK21LbfBBotGyOCGDRX3ItXBJjIEXYturIYK+33LAUKj3gxYyhtDbK3 jpmaaaq23f5kZOZHT8m1NhWfUlX/KjY5ukbWxobLkb5fgekVklSGUBSskoXKZVVfiEAo iCz4wkEKbi8ikTOP7JZ+1JRX+P5M6PEdQZZ3Y7+GkyqaTnrZkrR1FO/ct+NcaP8Zx/7Q mRuaA+HujLEwC2fzXiWtgn8/0aX2oqm/b5GLFh1fYjCJ+lDU2f/7beiOAj7a32JK1JvN iHJnLCNb3v616khtZN6S7lQKDFU3F25dfgErzkWOJ4mi42Tx2YXl43Ea75BqBhff1n8k r//A== 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=uZ2kJMwdLk4VknuajjnYXaysr32vhEZVF4WMuApqNbo=; b=sNzWlcvR8mfNi/vb/7OUUdXlgma26MVSaV4AeVOyq7PNwjAOPHbzNm6NHk/MKKI0r+ FZdxekne5yDdtzbzBoKRxUpdTOAVC5KLttFOSrHQj7ZDGuUPpfQsCWhfV6z0Z/wNoDhx MBfhQlRVaO48hcyDHIdswm92841cn5e13fTByMTlW4U9p18tSAERud4+zrkbuVlq6Bjd gSIKCTlbb3ApSBel4aRfeAu/2ls+KN1QylWNl4M2m8AvZyloxMhrgyMKIgdZT0gBOTXl WQCR6PwTDBxfMqjrUI7xG2eWWUVbcpw895m6LowAAW71ECK7BE8YW48MkvoeQy260mI1 Mwiw== X-Gm-Message-State: AODbwcCBnbGEuB6Ei2oUdwSSjBojzXFvqYwFTxWRNq1v9e2/8TbseVpR xM1Yv5UXextX0cDP X-Received: by 10.98.80.76 with SMTP id e73mr28610514pfb.31.1496218608955; Wed, 31 May 2017 01:16:48 -0700 (PDT) Received: from tahsin1.svl.corp.google.com ([100.123.230.167]) by smtp.gmail.com with ESMTPSA id g75sm25469724pfd.83.2017.05.31.01.16.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 May 2017 01:16:48 -0700 (PDT) From: Tahsin Erdogan To: Jan Kara , Theodore Ts'o , Andreas Dilger , Dave Kleikamp , Alexander Viro , Mark Fasheh , Joel Becker , Jens Axboe , Deepa Dinamani , Mike Christie , Fabian Frederick , linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org, Tahsin Erdogan Subject: [PATCH 06/28] ext4: ea_inode owner should be the same as the inode owner Date: Wed, 31 May 2017 01:14:55 -0700 Message-Id: <20170531081517.11438-6-tahsin@google.com> X-Mailer: git-send-email 2.13.0.219.gdb65acc882-goog In-Reply-To: <20170531081517.11438-1-tahsin@google.com> References: <20170531081517.11438-1-tahsin@google.com> 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 Quota charging is based on the ownership of the inode. Currently, the xattr inode owner is set to the caller which may be different from the parent inode owner. This is inconsistent with how quota is charged for xattr block and regular data block writes. Signed-off-by: Tahsin Erdogan --- fs/ext4/xattr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 8e123533315f..32ad2f2870e9 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -826,6 +826,7 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle, struct inode *inode) { struct inode *ea_inode = NULL; + uid_t owner[2] = { i_uid_read(inode), i_gid_read(inode) }; int err; /* @@ -833,7 +834,7 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle, * in the same group, or nearby one. */ ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode, - S_IFREG | 0600, NULL, inode->i_ino + 1, NULL, + S_IFREG | 0600, NULL, inode->i_ino + 1, owner, EXT4_EA_INODE_FL); if (!IS_ERR(ea_inode)) { ea_inode->i_op = &ext4_file_inode_operations;