From patchwork Thu Jan 30 10:46:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 3556251 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 27F48C02DC for ; Thu, 30 Jan 2014 10:46:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18C3C2018E for ; Thu, 30 Jan 2014 10:46:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25EBB20181 for ; Thu, 30 Jan 2014 10:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752261AbaA3KqZ (ORCPT ); Thu, 30 Jan 2014 05:46:25 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:51217 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbaA3KqY (ORCPT ); Thu, 30 Jan 2014 05:46:24 -0500 Received: from hch by bombadil.infradead.org with local (Exim 4.80.1 #2 (Red Hat Linux)) id 1W8p8V-000631-Kz; Thu, 30 Jan 2014 10:46:19 +0000 Date: Thu, 30 Jan 2014 02:46:19 -0800 From: Christoph Hellwig To: Sage Weil Cc: Linus Torvalds , Dave Jones , Linux Kernel Mailing List , ceph-devel@vger.kernel.org, linux-fsdevel , Christoph Hellwig , Al Viro , Guangliang Zhao , Li Wang , zheng.z.yan@intel.com Subject: Re: [GIT PULL] Ceph updates for -rc1 Message-ID: <20140130104619.GA13139@infradead.org> References: <20140128211021.GB1377@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Jan 29, 2014 at 06:30:00AM -0800, Sage Weil wrote: > The set_acl inode_operation wasn't getting set, and the prototype needed > to be adjusted a bit (it doesn't take a dentry anymore). All seems to be > well with the below patch. Btw, there's a few minor bits that should go on top of yours: - ->get_acl only gets called after we checked for a cached ACL, so no need to call get_cached_acl again. - no need to check IS_POSIXACL in ->get_acl, without that it should never get set as all the callers that set it already have the check. - you should be able to use the full posix_acl_create in CEPH Untested patch below: --- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 66d377a..9ab312e 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -66,13 +66,6 @@ struct posix_acl *ceph_get_acl(struct inode *inode, int type) char *value = NULL; struct posix_acl *acl; - if (!IS_POSIXACL(inode)) - return NULL; - - acl = ceph_get_cached_acl(inode, type); - if (acl != ACL_NOT_CACHED) - return acl; - switch (type) { case ACL_TYPE_ACCESS: name = POSIX_ACL_XATTR_ACCESS; @@ -190,41 +183,24 @@ out: int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) { - struct posix_acl *acl = NULL; - int ret = 0; - - if (!S_ISLNK(inode->i_mode)) { - if (IS_POSIXACL(dir)) { - acl = ceph_get_acl(dir, ACL_TYPE_DEFAULT); - if (IS_ERR(acl)) { - ret = PTR_ERR(acl); - goto out; - } - } + struct posix_acl *default_acl, *acl; + int error; - if (!acl) - inode->i_mode &= ~current_umask(); - } + error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); + if (error) + return error; - if (IS_POSIXACL(dir) && acl) { - if (S_ISDIR(inode->i_mode)) { - ret = ceph_set_acl(inode, acl, ACL_TYPE_DEFAULT); - if (ret) - goto out_release; - } - ret = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode); - if (ret < 0) - goto out; - else if (ret > 0) - ret = ceph_set_acl(inode, acl, ACL_TYPE_ACCESS); - else - cache_no_acl(inode); - } else { + if (!default_acl && !acl) cache_no_acl(inode); - } -out_release: - posix_acl_release(acl); -out: - return ret; + if (default_acl) { + error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); + posix_acl_release(default_acl); + } + if (acl) { + if (!error) + error = ceph_set_acl(inode, acl, ACL_TYPE_ACCESS); + posix_acl_release(acl); + } + return error; }