From patchwork Tue Jan 28 21:48:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Torvalds X-Patchwork-Id: 3548191 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 59B95C02DC for ; Tue, 28 Jan 2014 21:48:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6396C20107 for ; Tue, 28 Jan 2014 21:48:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AF3F200E6 for ; Tue, 28 Jan 2014 21:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932068AbaA1VsJ (ORCPT ); Tue, 28 Jan 2014 16:48:09 -0500 Received: from mail-vb0-f54.google.com ([209.85.212.54]:35863 "EHLO mail-vb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755205AbaA1VsH (ORCPT ); Tue, 28 Jan 2014 16:48:07 -0500 Received: by mail-vb0-f54.google.com with SMTP id w20so653890vbb.27 for ; Tue, 28 Jan 2014 13:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=2ZdkiFgTpjfO5nNB+F6yVUYMGKM5/dM5mBS4ArOIsrk=; b=W/St32e7+9rXGjOHwf6j16aBYhcWrjLFBTQNRc1UWkd3CGWNw9Jz67khc7mn3a1ua5 4UtjAiXWZmyl/bnMQHiGapPpvEOWTQsnJsJd/rTY8h/BIGl1v+BArVj6G0SxcHoSAlTq kCN1NoXaLAduhtx0nw1uA3sPJ/ep1yNIqSfpZTlS9hj6HmRleIV0OT5MtTcTZ/M58vlL rfa0+l6Z04/MfKAwj9g8680c+tAZ9WgadgPnErI61si9wrvP6m5aKwehOJMPfB7/aayS WDaNxWh1S7GYWM8yoHEvx0B7SUw6AsYhLhtf3N5MxKTIxhvP9Pqi6LCAZgDKEkyLaJ2S EmAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=2ZdkiFgTpjfO5nNB+F6yVUYMGKM5/dM5mBS4ArOIsrk=; b=A4UQT3Iaxzv/sgdq096A+iYM4D/m+yiO2e5MwEBLV6MnXHXAoDytevsXvbYJ+GfhFs jCytmL1s3H/vWqMHgUOBvWvMzyOntjQA7eVv60eFR8yRPGCtfxUvBCxRp5fba18sj/vm nA1XoMYVPsMwLAAOrUzwGRXgdH8siALAO8eto= MIME-Version: 1.0 X-Received: by 10.58.119.161 with SMTP id kv1mr3007279veb.21.1390945685983; Tue, 28 Jan 2014 13:48:05 -0800 (PST) Received: by 10.221.8.73 with HTTP; Tue, 28 Jan 2014 13:48:05 -0800 (PST) In-Reply-To: <20140128211021.GB1377@redhat.com> References: <20140128211021.GB1377@redhat.com> Date: Tue, 28 Jan 2014 13:48:05 -0800 X-Google-Sender-Auth: WSqAfJ_mQr91WV32fcjWxlEDWj4 Message-ID: Subject: Re: [GIT PULL] Ceph updates for -rc1 From: Linus Torvalds To: Dave Jones , Sage Weil , Linus Torvalds , Linux Kernel Mailing List , ceph-devel@vger.kernel.org, linux-fsdevel , Christoph Hellwig , Al Viro , Guangliang Zhao , Li Wang 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,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable 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 Tue, Jan 28, 2014 at 1:10 PM, Dave Jones wrote: > > This breaks the build for me. It is my merge (Christoph's ACL changes came in today through the VFS tree from Al). I was doing the merges today on my laptop (I had jury duty yesterday and today), and so I didn't do the allmodconfig build I would normally do on my (much faster) desktop. Well, actually I did do the full fs builds for the earlier pulls that actually had some conflicts, but not for the ceph pull. The conflict was hidden by the fact that the whole cifs ACL support is new, so there was no data conflict, just a silent semantic conflict between the new smarter ACL helpers and the new ACL use in CIFS. I'm back home now (yay, all the afternoon cases got settled), and I see the problem now. I should have done an allmodconfig build immediately after coming home, but I never even thought of it. Anyway, here's an *untested* conversion to the new posix acl helper infrastructure. I do wonder if ceph_init_acl() could be converted to posix_acl_create(), right now that part is a "non-conversion" - it's just made to use __posix_acl_create() that implements the old interface. Al, Christoph, can you please check my conversion for sanity from a generic posix-acl standpoint? Sage, Guangliang, Li, can you check the actual cifs usage/sanity of the attached patch? Sorry about the messed-up merge. Although I also blame Al, because he's horrible about having his changes in linux-next, so nobody was ever really aware of this semantic conflict. Al. Bad, bad boy. Consider yourself hit with a rolled-up newspaper. Linus fs/ceph/acl.c | 103 +------------------------------------------------------- fs/ceph/inode.c | 3 +- fs/ceph/super.h | 3 -- fs/ceph/xattr.c | 5 +-- 4 files changed, 6 insertions(+), 108 deletions(-) diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 64fddbc1d17b..f6911284c9bd 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -213,7 +213,7 @@ int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) if (ret) goto out_release; } - ret = posix_acl_create(&acl, GFP_NOFS, &inode->i_mode); + ret = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode); if (ret < 0) goto out; else if (ret > 0) @@ -229,104 +229,3 @@ out_release: out: return ret; } - -int ceph_acl_chmod(struct dentry *dentry, struct inode *inode) -{ - struct posix_acl *acl; - int ret = 0; - - if (S_ISLNK(inode->i_mode)) { - ret = -EOPNOTSUPP; - goto out; - } - - if (!IS_POSIXACL(inode)) - goto out; - - acl = ceph_get_acl(inode, ACL_TYPE_ACCESS); - if (IS_ERR_OR_NULL(acl)) { - ret = PTR_ERR(acl); - goto out; - } - - ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); - if (ret) - goto out; - ret = ceph_set_acl(dentry, inode, acl, ACL_TYPE_ACCESS); - posix_acl_release(acl); -out: - return ret; -} - -static int ceph_xattr_acl_get(struct dentry *dentry, const char *name, - void *value, size_t size, int type) -{ - struct posix_acl *acl; - int ret = 0; - - if (!IS_POSIXACL(dentry->d_inode)) - return -EOPNOTSUPP; - - acl = ceph_get_acl(dentry->d_inode, type); - if (IS_ERR(acl)) - return PTR_ERR(acl); - if (acl == NULL) - return -ENODATA; - - ret = posix_acl_to_xattr(&init_user_ns, acl, value, size); - posix_acl_release(acl); - - return ret; -} - -static int ceph_xattr_acl_set(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags, int type) -{ - int ret = 0; - struct posix_acl *acl = NULL; - - if (!inode_owner_or_capable(dentry->d_inode)) { - ret = -EPERM; - goto out; - } - - if (!IS_POSIXACL(dentry->d_inode)) { - ret = -EOPNOTSUPP; - goto out; - } - - if (value) { - acl = posix_acl_from_xattr(&init_user_ns, value, size); - if (IS_ERR(acl)) { - ret = PTR_ERR(acl); - goto out; - } - - if (acl) { - ret = posix_acl_valid(acl); - if (ret) - goto out_release; - } - } - - ret = ceph_set_acl(dentry, dentry->d_inode, acl, type); - -out_release: - posix_acl_release(acl); -out: - return ret; -} - -const struct xattr_handler ceph_xattr_acl_default_handler = { - .prefix = POSIX_ACL_XATTR_DEFAULT, - .flags = ACL_TYPE_DEFAULT, - .get = ceph_xattr_acl_get, - .set = ceph_xattr_acl_set, -}; - -const struct xattr_handler ceph_xattr_acl_access_handler = { - .prefix = POSIX_ACL_XATTR_ACCESS, - .flags = ACL_TYPE_ACCESS, - .get = ceph_xattr_acl_get, - .set = ceph_xattr_acl_set, -}; diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 6fc10a7d7c59..8b8b506636cc 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "super.h" #include "mds_client.h" @@ -1805,7 +1806,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) __mark_inode_dirty(inode, inode_dirty_flags); if (ia_valid & ATTR_MODE) { - err = ceph_acl_chmod(dentry, inode); + err = posix_acl_chmod(inode, attr->ia_mode); if (err) goto out_put; } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index c299f7d19bf3..345933948b6e 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -736,15 +736,12 @@ extern void __init ceph_xattr_init(void); extern void ceph_xattr_exit(void); /* acl.c */ -extern const struct xattr_handler ceph_xattr_acl_access_handler; -extern const struct xattr_handler ceph_xattr_acl_default_handler; extern const struct xattr_handler *ceph_xattr_handlers[]; #ifdef CONFIG_CEPH_FS_POSIX_ACL struct posix_acl *ceph_get_acl(struct inode *, int); int ceph_init_acl(struct dentry *, struct inode *, struct inode *); -int ceph_acl_chmod(struct dentry *, struct inode *); void ceph_forget_all_cached_acls(struct inode *inode); #else diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index c7581f3733c1..898b6565ad3e 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -6,6 +6,7 @@ #include #include +#include #include #define XATTR_CEPH_PREFIX "ceph." @@ -17,8 +18,8 @@ */ const struct xattr_handler *ceph_xattr_handlers[] = { #ifdef CONFIG_CEPH_FS_POSIX_ACL - &ceph_xattr_acl_access_handler, - &ceph_xattr_acl_default_handler, + &posix_acl_access_xattr_handler, + &posix_acl_default_xattr_handler, #endif NULL, };