From patchwork Fri Oct 22 17:11:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CFACC433FE for ; Fri, 22 Oct 2021 17:11:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A861611CB for ; Fri, 22 Oct 2021 17:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233718AbhJVRNp (ORCPT ); Fri, 22 Oct 2021 13:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233930AbhJVRNd (ORCPT ); Fri, 22 Oct 2021 13:13:33 -0400 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1359C061766 for ; Fri, 22 Oct 2021 10:11:15 -0700 (PDT) Received: by mail-qk1-x729.google.com with SMTP id j12so5295736qkk.5 for ; Fri, 22 Oct 2021 10:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TlUoDNI6gjQ3bF7gQnXIUNEqr/12MDT6JBnLNFSRDQc=; b=ElkduZccNpncOYpC9RQmLJtaEsWXeHkh7Rty5BCOMD19/8s3hMUPrwHudToqMtHPcO zagiNFtMkwqoGrp3Abdt5mI1cuGx7bKFspWMXQBalhHoeNHQICWYna/RXrHbGiZ40gt1 W+SVB3Exs80cwzy/Elud0rnDw5WZy+L3Mffn2bTaRbotBArh5h92gLDvOArzOhgruoo3 xshI+Vc9b1u2GSVbfK4FpHJGuBZDWMjVZdz4d8JZk4MuDvwj9ll5GIcFGngZ7WfSndq+ CUlU2P7U/9Gy2oku5Wwa1YmblQBfmFizu4hVh/E6badw7TiMncyVd+/VdZ9Gzl25GCen h38A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TlUoDNI6gjQ3bF7gQnXIUNEqr/12MDT6JBnLNFSRDQc=; b=FFR3xxfbFr6JIZyMmlC7jHK+8kuo5TJSreJOev9abxuuBxAgCDNiy2vxWPG3CAwoLj 6EgCwijBBgBu5XPBuxjpvzR8Zb3xMXBuoKC3KaErsT737fz8zMPmO/i1Z/tmo0jeNGqH IVL1rbBG4LHQk39jRcL2r+zRzdzsesx6qz5eV0SaAfw8Fj/e3CjXedaObxrRT0Vta05U uT6hOG5vU088/vCtXzQST+GhzvfZqeph8wCI5mIYWyAAmNKzPloKjhqTNBbsrCyj8y/C 5KMs5PzyqKrY6htlOeWJwpKlGZJujAf8+o9owmpAppo1aCXbNqh9RppXa2CcGxzGBeqG UI+Q== X-Gm-Message-State: AOAM5315chER4A0TRMNaCKYQoUKPyQpsyvOgrUqfjVTMzlQrFvCgSjsR 6MhsBIwqbfsTedEGoQorQPg= X-Google-Smtp-Source: ABdhPJwDPZ0OgFGhmx/zc2P9JDd/5HqzU5HIyaHEG3bTId03F5P/OogcgpwJs/lH7/QQ/LlxHDuopg== X-Received: by 2002:a37:67cc:: with SMTP id b195mr1074818qkc.99.1634922674913; Fri, 22 Oct 2021 10:11:14 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:14 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 01/14] NFS: Create a new nfs_alloc_fattr_with_label() function Date: Fri, 22 Oct 2021 13:11:00 -0400 Message-Id: <20211022171113.16739-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker For creating fattrs with the label field already allocated for us. I also update nfs_free_fattr() to free the label in the end. Signed-off-by: Anna Schumaker --- fs/nfs/getroot.c | 17 ++++++----------- fs/nfs/inode.c | 17 +++++++++++++++++ fs/nfs/internal.h | 9 --------- include/linux/nfs_fs.h | 13 +++++++++++++ 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 59355c106ece..7604cb6a0ac2 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -80,18 +80,15 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) goto out; /* get the actual root for this mount */ - fsinfo.fattr = nfs_alloc_fattr(); + fsinfo.fattr = nfs_alloc_fattr_with_label(server); if (fsinfo.fattr == NULL) goto out_name; - fsinfo.fattr->label = nfs4_label_alloc(server, GFP_KERNEL); - if (IS_ERR(fsinfo.fattr->label)) - goto out_fattr; error = server->nfs_client->rpc_ops->getroot(server, ctx->mntfh, &fsinfo); if (error < 0) { dprintk("nfs_get_root: getattr error = %d\n", -error); nfs_errorf(fc, "NFS: Couldn't getattr on root"); - goto out_label; + goto out_fattr; } inode = nfs_fhget(s, ctx->mntfh, fsinfo.fattr, NULL); @@ -99,12 +96,12 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) dprintk("nfs_get_root: get root inode failed\n"); error = PTR_ERR(inode); nfs_errorf(fc, "NFS: Couldn't get root inode"); - goto out_label; + goto out_fattr; } error = nfs_superblock_set_dummy_root(s, inode); if (error != 0) - goto out_label; + goto out_fattr; /* root dentries normally start off anonymous and get spliced in later * if the dentry tree reaches them; however if the dentry already @@ -115,7 +112,7 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) dprintk("nfs_get_root: get root dentry failed\n"); error = PTR_ERR(root); nfs_errorf(fc, "NFS: Couldn't get root dentry"); - goto out_label; + goto out_fattr; } security_d_instantiate(root, inode); @@ -154,8 +151,6 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) nfs_setsecurity(inode, fsinfo.fattr, fsinfo.fattr->label); error = 0; -out_label: - nfs4_label_free(fsinfo.fattr->label); out_fattr: nfs_free_fattr(fsinfo.fattr); out_name: @@ -165,5 +160,5 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) error_splat_root: dput(fc->root); fc->root = NULL; - goto out_label; + goto out_fattr; } diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 853213b3a209..309a8921eea3 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1586,6 +1586,23 @@ struct nfs_fattr *nfs_alloc_fattr(void) } EXPORT_SYMBOL_GPL(nfs_alloc_fattr); +struct nfs_fattr *nfs_alloc_fattr_with_label(struct nfs_server *server) +{ + struct nfs_fattr *fattr = nfs_alloc_fattr(); + + if (!fattr) + return NULL; + + fattr->label = nfs4_label_alloc(server, GFP_NOFS); + if (IS_ERR(fattr->label)) { + kfree(fattr); + return NULL; + } + + return fattr; +} +EXPORT_SYMBOL_GPL(nfs_alloc_fattr_with_label); + struct nfs_fh *nfs_alloc_fhandle(void) { struct nfs_fh *fh; diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 66fc936834f2..7483f196c6ef 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -341,14 +341,6 @@ nfs4_label_copy(struct nfs4_label *dst, struct nfs4_label *src) return dst; } -static inline void nfs4_label_free(struct nfs4_label *label) -{ - if (label) { - kfree(label->label); - kfree(label); - } - return; -} static inline void nfs_zap_label_cache_locked(struct nfs_inode *nfsi) { @@ -357,7 +349,6 @@ static inline void nfs_zap_label_cache_locked(struct nfs_inode *nfsi) } #else static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; } -static inline void nfs4_label_free(void *label) {} static inline void nfs_zap_label_cache_locked(struct nfs_inode *nfsi) { } diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index b9a8b925db43..56ba52ec2228 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -421,9 +421,22 @@ extern void nfs_fattr_set_barrier(struct nfs_fattr *fattr); extern unsigned long nfs_inc_attr_generation_counter(void); extern struct nfs_fattr *nfs_alloc_fattr(void); +extern struct nfs_fattr *nfs_alloc_fattr_with_label(struct nfs_server *server); + +static inline void nfs4_label_free(struct nfs4_label *label) +{ +#ifdef CONFIG_NFS_V4_SECURITY_LABEL + if (label) { + kfree(label->label); + kfree(label); + } +#endif +} static inline void nfs_free_fattr(const struct nfs_fattr *fattr) { + if (fattr) + nfs4_label_free(fattr->label); kfree(fattr); } From patchwork Fri Oct 22 17:11:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAF70C43219 for ; Fri, 22 Oct 2021 17:11:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8E1D611CB for ; Fri, 22 Oct 2021 17:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233890AbhJVRNs (ORCPT ); Fri, 22 Oct 2021 13:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233932AbhJVRNe (ORCPT ); Fri, 22 Oct 2021 13:13:34 -0400 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C8D5C061767 for ; Fri, 22 Oct 2021 10:11:16 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id 77so5252902qkh.6 for ; Fri, 22 Oct 2021 10:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ATXqp+u2xOFY4EmAsSU7YBw6zEz6R5+BwfQfDiixPWE=; b=N1GUZft7Cv4FFBoNwRWK6k95pOtHW5svC8kYNqlrisvve0DMfUmCILz5kczki0Osxy b4GxU1QngdNfgd9Ak6IxNIY7WIx8PeEkgiRol5TSjhhGiNpe8mn7jFCedXBZc4WZXs1X mcCr5nC2ptQPD7gFR/uWS4TEJ1MmCZ0aFWQLxP+icioW59rKi7KKGUHPGWi7hosTI1fX 85tHhCRTe1u1Puex/of6HhRfjW3ztXoSwfhNoZD2dOAqkor0iOvss6ID5+E/+uqSfaCI xPLe8nWaZnWrTkt7UheoRlusSCalyxpp2D5OqFaWqi5pjhpvooa1Hzof3/GZ9FAXAgqM nlTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ATXqp+u2xOFY4EmAsSU7YBw6zEz6R5+BwfQfDiixPWE=; b=oXUCpdOrr/DP2h6LKxesjOdNM51s9a/65z12UlqRkFn11LcAX0IwnxhuF77/J9rbhw /JTJ7+zrfptsK4RcXgtSBH+LkoymL0IfUkWZ8xAUbBlhT4eJzhsN8/7DjyOKbE84AQkA XswREvn2evoAMrTxoZ0QaJGt26FKfGckR46+uR7KkwKCitURVwDsS2ihhZCuovcQgTZf l0xjxlaNw8VX95iMf5Hx6pqxhICxVjF0GKJReKJ0FCheW0dpWh1+Ylf0C2ULHQw8YunT 5914iJFqh7ZJBymn1ysExH50jhfcPWYpRpjwVU51C+O9MrStzofXQgiUMUGJVaRQZfl4 ck+A== X-Gm-Message-State: AOAM532PmJ0qQS/rJTazVuIvCgTkfq9B0ZAc1l/3My5UOEjfGVZcn/hU bZGwR6+qbKDRQw/ZzYvsUSM= X-Google-Smtp-Source: ABdhPJwQ5sPokgAvarlKjZz9ddKTMApleheOOx9yOMUbx1IVpP1pu+STbG7ML5Q68fuHEhi0WKB1kg== X-Received: by 2002:ae9:de82:: with SMTP id s124mr1120567qkf.182.1634922675503; Fri, 22 Oct 2021 10:11:15 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:15 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 02/14] NFS: Remove the nfs4_label from the nfs_entry struct Date: Fri, 22 Oct 2021 13:11:01 -0400 Message-Id: <20211022171113.16739-3-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker And instead allocate the fattr using nfs_alloc_fattr_with_label() Signed-off-by: Anna Schumaker --- fs/nfs/dir.c | 21 +++++++-------------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 1a6d2867fba4..3daa1fd60751 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -680,7 +680,8 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry, nfs_set_verifier(dentry, dir_verifier); status = nfs_refresh_inode(d_inode(dentry), entry->fattr); if (!status) - nfs_setsecurity(d_inode(dentry), entry->fattr, entry->label); + nfs_setsecurity(d_inode(dentry), entry->fattr, + entry->fattr->label); goto out; } else { d_invalidate(dentry); @@ -694,7 +695,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry, goto out; } - inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr, entry->label); + inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr, entry->fattr->label); alias = d_splice_alias(inode, dentry); d_lookup_done(dentry); if (alias) { @@ -730,8 +731,8 @@ static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc, xdr_set_scratch_page(&stream, scratch); do { - if (entry->label) - entry->label->len = NFS4_MAXLABELLEN; + if (entry->fattr->label) + entry->fattr->label->len = NFS4_MAXLABELLEN; status = xdr_decode(desc, entry, &stream); if (status != 0) @@ -836,21 +837,15 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, return -ENOMEM; entry->cookie = nfs_readdir_page_last_cookie(page); entry->fh = nfs_alloc_fhandle(); - entry->fattr = nfs_alloc_fattr(); + entry->fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); entry->server = NFS_SERVER(inode); if (entry->fh == NULL || entry->fattr == NULL) goto out; - entry->label = nfs4_label_alloc(NFS_SERVER(inode), GFP_NOWAIT); - if (IS_ERR(entry->label)) { - status = PTR_ERR(entry->label); - goto out; - } - array_size = (dtsize + PAGE_SIZE - 1) >> PAGE_SHIFT; pages = nfs_readdir_alloc_pages(array_size); if (!pages) - goto out_release_label; + goto out; do { unsigned int pglen; @@ -873,8 +868,6 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, } while (!status && nfs_readdir_page_needs_filling(page)); nfs_readdir_free_pages(pages, array_size); -out_release_label: - nfs4_label_free(entry->label); out: nfs_free_fattr(entry->fattr); nfs_free_fhandle(entry->fh); diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index a8cff19c6f00..466b2832de75 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -7475,7 +7475,7 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, return -EAGAIN; if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, - NULL, entry->label, entry->server) < 0) + NULL, entry->fattr->label, entry->server) < 0) return -EAGAIN; if (entry->fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) entry->ino = entry->fattr->mounted_on_fileid; diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index e9698b6278a5..9960f6628066 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -753,7 +753,6 @@ struct nfs_entry { int eof; struct nfs_fh * fh; struct nfs_fattr * fattr; - struct nfs4_label *label; unsigned char d_type; struct nfs_server * server; }; From patchwork Fri Oct 22 17:11:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF082C433EF for ; Fri, 22 Oct 2021 17:11:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2AB16124D for ; Fri, 22 Oct 2021 17:11:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233862AbhJVRNq (ORCPT ); Fri, 22 Oct 2021 13:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233937AbhJVRNe (ORCPT ); Fri, 22 Oct 2021 13:13:34 -0400 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0111EC061764 for ; Fri, 22 Oct 2021 10:11:17 -0700 (PDT) Received: by mail-qk1-x732.google.com with SMTP id a13so5141410qkg.11 for ; Fri, 22 Oct 2021 10:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u0LCQ2Q01yFPOa55Zc528lPs7tc3fuvW5Z082KuZArM=; b=R5L2y2Jw9ZjUM4vNIcylyvs8OJvn0hIGBDEBjRb528FjV7rpRJ4iyhnwg71EDWCHjc k1uAWI1hDEtiUYfRdU24J5UU0sjNQVejT7iCLBW9X8f6h5N7op897u2BQxTnNKAowMe+ vVRd67vd3Fe7vwz7iZreYs1l46JIh9EnMCKmgT66xk0w7pUtIVHT6CT/SfRsA8IrVTCe 0Hz9ZdXGcTX2KIo6XEc0LX9Bt+y3MRaTsJUUo3zPxUedUBlQQqhzmVkTJRWI8QXymETU Q1qvXFXE2RIQul9FIyNxgZKToihi//Gf6CvXvfmzNULc41KRLJCoWC9L2XufOO4L9tSw MjNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=u0LCQ2Q01yFPOa55Zc528lPs7tc3fuvW5Z082KuZArM=; b=yfLOHs0XcIQDXM/vDeBZ/ih/wATckSn9tKoFZq5xhsNTjbEpwdxqAg34DOU+TUMQfK l1kMhmGNrzULXooXvSUc0ImmsBfGBSZ/qHeUYVPwS7ZQAgJ+aUKf16ErRnq4v58rmx/e IdwnzjB77s75NML6uO+hOxujroIPMs/C/xSApXc+nVy1Jcoa07nzz3bO2ScANlnHIU/5 Bp0h10A4JfUDiIZAcVn9nYneCst0wETYN6uKMUkKGIZ/c/Otic9gwqKiW9yPXDMCLr09 dohqkd/8e8GJfMx4JT4NqngTvFUYtot4OeA7sue3spl065BXm0oHXSnvA1cygx9YSSpx h/Xw== X-Gm-Message-State: AOAM531Y/kZD80J68SNjI5Wq6IQ3APqosKisl4SNxp+BXEw/SmODKG2W CmIFFRvy+SHLbNj39NB/gk4= X-Google-Smtp-Source: ABdhPJzZtT67cWAQY0IjHaz6f3S27nZvt50/a61FTbk01vnGEejnpF8yvICwEsWxZblLLoeFsM95pw== X-Received: by 2002:a05:620a:25c9:: with SMTP id y9mr1101721qko.386.1634922676088; Fri, 22 Oct 2021 10:11:16 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:15 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 03/14] NFS: Remove the nfs4_label from the nfs4_create_res struct Date: Fri, 22 Oct 2021 13:11:02 -0400 Message-Id: <20211022171113.16739-4-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Instead, use the label embedded in the attached fattr. Signed-off-by: Anna Schumaker --- fs/nfs/nfs4proc.c | 12 +++++------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e1214bb6b7ee..06569a35a6df 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4851,7 +4851,6 @@ struct nfs4_createdata { struct nfs4_create_res res; struct nfs_fh fh; struct nfs_fattr fattr; - struct nfs4_label *label; }; static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir, @@ -4863,8 +4862,8 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir, if (data != NULL) { struct nfs_server *server = NFS_SERVER(dir); - data->label = nfs4_label_alloc(server, GFP_KERNEL); - if (IS_ERR(data->label)) + data->fattr.label = nfs4_label_alloc(server, GFP_KERNEL); + if (IS_ERR(data->fattr.label)) goto out_free; data->msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CREATE]; @@ -4875,12 +4874,11 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir, data->arg.name = name; data->arg.attrs = sattr; data->arg.ftype = ftype; - data->arg.bitmask = nfs4_bitmask(server, data->label); + data->arg.bitmask = nfs4_bitmask(server, data->fattr.label); data->arg.umask = current_umask(); data->res.server = server; data->res.fh = &data->fh; data->res.fattr = &data->fattr; - data->res.label = data->label; nfs_fattr_init(data->res.fattr); } return data; @@ -4902,14 +4900,14 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_ data->res.fattr->time_start, NFS_INO_INVALID_DATA); spin_unlock(&dir->i_lock); - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.label); + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.fattr->label); } return status; } static void nfs4_free_createdata(struct nfs4_createdata *data) { - nfs4_label_free(data->label); + nfs4_label_free(data->fattr.label); kfree(data); } diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 466b2832de75..98594a97529d 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -6361,7 +6361,7 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_getfh(xdr, res->fh); if (status) goto out; - decode_getfattr_label(xdr, res->fattr, res->label, res->server); + decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); out: return status; } diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 9960f6628066..5aba81b74c98 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1040,7 +1040,6 @@ struct nfs4_create_res { const struct nfs_server * server; struct nfs_fh * fh; struct nfs_fattr * fattr; - struct nfs4_label *label; struct nfs4_change_info dir_cinfo; }; From patchwork Fri Oct 22 17:11:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69EA9C433FE for ; Fri, 22 Oct 2021 17:11:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57582611F2 for ; Fri, 22 Oct 2021 17:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233816AbhJVRNt (ORCPT ); Fri, 22 Oct 2021 13:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233944AbhJVRNf (ORCPT ); Fri, 22 Oct 2021 13:13:35 -0400 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4A90C061766 for ; Fri, 22 Oct 2021 10:11:17 -0700 (PDT) Received: by mail-qk1-x729.google.com with SMTP id r15so5201323qkp.8 for ; Fri, 22 Oct 2021 10:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7178+k9HGwpv06ui7KmehzZMIDhQrwDptPJIvqT4zWc=; b=KQLWQ0QnUw4YyOdFoFN2GlcQid3A98e/oQB7CialyZZUtaZusxRpR0iVd4avvj4zkq f4P4K88JnZdBkYTCjwHHdqIobdxITnw97Yg93antekKLQO6XmUB5kQhXwYNqPjDUIfkE OO3R6NNwV9UuuLeDGe3NwmKISjH3SqmVWHv6pujJMlm/JXKx1lFQnTYWeY2ZXJmbhsJc EGEBgitMEcKXWIQCdYVqpd+qckmawspRTqo7wQq0DtNqIq+lVBaifjo913jjZxvJ4DGS qC1XPTZWkPlAt1jvwhwKAzkCb90pn0HmC9wqghIXUvbvlxhDFcaHKKJYc5M+GvMxZZ/w QEpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7178+k9HGwpv06ui7KmehzZMIDhQrwDptPJIvqT4zWc=; b=FEdjNsVmhDESHcLTGZpR6uIZt+3Tzhn4QHOmVaeV672/MJCkOsEM46X3jl0GfATg3W WFCTxOFnbYd7aubY3nwjh1es+2FY4vQ/SKc3pgHWOuy7Bdyvnqrz+bmB1pFIr16qclVD 4YipuiKBgJUpYyk/b5EaNjK/Xkp/ipPhl/q1BCXvjUBs2WLF6CU3B9ubmfgjXFJ91XZg KDBU3O1ce1MIQlpi08MTL2gAPhC6MLvila/4F0ReBS50DZqB9Hf5ui+L6qf7oDKbziM6 5DJv4p+NxyzOXymjCpxxxriF8LMKnm85sTvjqAOMJvls2bUPQk6bz1+eZtxM+sDTpNTD 5jCQ== X-Gm-Message-State: AOAM532yNapGa81fUPG3SHEgjPt3/qzRwgENjFPCxQi/U+0a8dx21KGT XGmK5dznOfOzCjH7nm1sQwU= X-Google-Smtp-Source: ABdhPJzqIFW8on3+TtJBsESumV2sjoqSsB+omlqLFiK4JzUasPGWckCdSc8Cj2JVwaN35YdEsvCobg== X-Received: by 2002:a37:b13:: with SMTP id 19mr1099507qkl.430.1634922676854; Fri, 22 Oct 2021 10:11:16 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:16 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 04/14] NFS: Remove the nfs4_label from the nfs4_link_res struct Date: Fri, 22 Oct 2021 13:11:03 -0400 Message-Id: <20211022171113.16739-5-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Again, use the fattr's label field instead. Signed-off-by: Anna Schumaker --- fs/nfs/nfs4proc.c | 16 +++------------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 06569a35a6df..fed15eafc03b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4791,7 +4791,6 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct }; struct nfs4_link_res res = { .server = server, - .label = NULL, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LINK], @@ -4800,18 +4799,12 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct }; int status = -ENOMEM; - res.fattr = nfs_alloc_fattr(); + res.fattr = nfs_alloc_fattr_with_label(server); if (res.fattr == NULL) goto out; - res.label = nfs4_label_alloc(server, GFP_KERNEL); - if (IS_ERR(res.label)) { - status = PTR_ERR(res.label); - goto out; - } - nfs4_inode_make_writeable(inode); - nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, res.label), inode, + nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, res.fattr->label), inode, NFS_INO_INVALID_CHANGE); status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); if (!status) { @@ -4820,12 +4813,9 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct nfs4_inc_nlink(inode); status = nfs_post_op_update_inode(inode, res.fattr); if (!status) - nfs_setsecurity(inode, res.fattr, res.label); + nfs_setsecurity(inode, res.fattr, res.fattr->label); } - - nfs4_label_free(res.label); - out: nfs_free_fattr(res.fattr); return status; diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 98594a97529d..4ce6d2430ff1 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -6331,7 +6331,7 @@ static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_restorefh(xdr); if (status) goto out; - decode_getfattr_label(xdr, res->fattr, res->label, res->server); + decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); out: return status; } diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 5aba81b74c98..d55bf3fd5167 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1079,7 +1079,6 @@ struct nfs4_link_res { struct nfs4_sequence_res seq_res; const struct nfs_server * server; struct nfs_fattr * fattr; - struct nfs4_label *label; struct nfs4_change_info cinfo; struct nfs_fattr * dir_attr; }; From patchwork Fri Oct 22 17:11:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578219 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C998CC4332F for ; Fri, 22 Oct 2021 17:11:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B777C611CB for ; Fri, 22 Oct 2021 17:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233848AbhJVRNv (ORCPT ); Fri, 22 Oct 2021 13:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233954AbhJVRNg (ORCPT ); Fri, 22 Oct 2021 13:13:36 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AFF3C061764 for ; Fri, 22 Oct 2021 10:11:18 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id x123so5252468qke.7 for ; Fri, 22 Oct 2021 10:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c4AgfJ1e9Qf2D5nt6QqsHll9uhHkm7nf6JI0zJvbN3U=; b=kwCVCS9CZQsT1C6OgA+9VhOd+BPxNdHWoPO8aS9uDCBN1iUdmLdSKgfvDZ+68p/gRQ fk9K1SdiFiU4cxPLtvHDdN1qpt6Xy/W0RZpLDwxPbExK5l2y+LjO6zAKzKtV5NXLQoRF uCng4NuL2WBzL+ut4sI0MIgbilGjeZdU13JzL9xJJuuztEsVBT9iPTp5mGzb6xA9bSYW Pz0beJSgaQ9fHRkncqIqF+1MfiHlRjTwJnay25jet+JDKV/qG4pJ2C+2ZxhcqRV2edU9 nj9lulmbc9lLOsyhZEMEBCmlv6q4u7sFKygYzNH7qaFHO3dtYvT6kXIZ51UBbVy4M/Im M/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=c4AgfJ1e9Qf2D5nt6QqsHll9uhHkm7nf6JI0zJvbN3U=; b=iwQn7jyl9TMj0lZ3RpL7SZnCO4411JUd2F+UPs1HBm6P52r/bh+ri8SOb9gINSDKC9 CsTmeBX75TdM2cLqLVTFbl+VOX9P3AHpy5rBq80cL+sDnPBTO9Kuc3suSdUBO/Bl9L7b +dBK4m1HwaSeSNR2qQnB1Qrwir0QytbTt5/qdrD2nYx6ligL02EAx2UVnVhmAJkNEcQw sEy53uhR5yYcuyQKJaiDTRccyzLg2mpG01SOPVnE3tw9crNwKq78tP9M3fniFWXtjBv9 Ur7f9FEK9C70lsP5xapt7Xj86Js56Afedz9Hx6lrIXxM2ColZgqgIdzSifxCViBmdDdg ANGQ== X-Gm-Message-State: AOAM530irTezArAjjXQXTQj2RgNer5GhNfkMj34eQlUgmCONSWsVe/iQ WZsLTdO1vHSB5+OOrnn1iXI= X-Google-Smtp-Source: ABdhPJxPAP005u4QGNnHEVek+5a38KT/d8aPpTXDcQ0Ohja4e6z0FB97zcPhruiBiMg7AuALBmkYPg== X-Received: by 2002:a37:8387:: with SMTP id f129mr1083890qkd.79.1634922677482; Fri, 22 Oct 2021 10:11:17 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:17 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 05/14] NFS: Remove the label from the nfs4_lookup_res struct Date: Fri, 22 Oct 2021 13:11:04 -0400 Message-Id: <20211022171113.16739-6-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker And usethe fattr's label field instead. I also adjust function calls to remove labels along the way. Signed-off-by: Anna Schumaker --- fs/nfs/dir.c | 34 ++++++++++++---------------------- fs/nfs/namespace.c | 3 +-- fs/nfs/nfs3proc.c | 3 +-- fs/nfs/nfs4proc.c | 16 +++++++--------- fs/nfs/nfs4xdr.c | 4 ++-- fs/nfs/proc.c | 3 +-- include/linux/nfs_xdr.h | 4 +--- 7 files changed, 25 insertions(+), 42 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 3daa1fd60751..5f6996ee46be 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1488,19 +1488,17 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, { struct nfs_fh *fhandle; struct nfs_fattr *fattr; - struct nfs4_label *label; unsigned long dir_verifier; int ret; ret = -ENOMEM; fhandle = nfs_alloc_fhandle(); - fattr = nfs_alloc_fattr(); - label = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); - if (fhandle == NULL || fattr == NULL || IS_ERR(label)) + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); + if (fhandle == NULL || fattr == NULL) goto out; dir_verifier = nfs_save_change_attribute(dir); - ret = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, label); + ret = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr); if (ret < 0) { switch (ret) { case -ESTALE: @@ -1519,7 +1517,7 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, if (nfs_refresh_inode(inode, fattr) < 0) goto out; - nfs_setsecurity(inode, fattr, label); + nfs_setsecurity(inode, fattr, fattr->label); nfs_set_verifier(dentry, dir_verifier); /* set a readdirplus hint that we had a cache miss */ @@ -1528,7 +1526,6 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, out: nfs_free_fattr(fattr); nfs_free_fhandle(fhandle); - nfs4_label_free(label); /* * If the lookup failed despite the dentry change attribute being @@ -1752,7 +1749,6 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in struct inode *inode = NULL; struct nfs_fh *fhandle = NULL; struct nfs_fattr *fattr = NULL; - struct nfs4_label *label = NULL; unsigned long dir_verifier; int error; @@ -1771,27 +1767,23 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in res = ERR_PTR(-ENOMEM); fhandle = nfs_alloc_fhandle(); - fattr = nfs_alloc_fattr(); + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(dir)); if (fhandle == NULL || fattr == NULL) goto out; - label = nfs4_label_alloc(NFS_SERVER(dir), GFP_NOWAIT); - if (IS_ERR(label)) - goto out; - dir_verifier = nfs_save_change_attribute(dir); trace_nfs_lookup_enter(dir, dentry, flags); - error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, label); + error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr); if (error == -ENOENT) goto no_entry; if (error < 0) { res = ERR_PTR(error); - goto out_label; + goto out; } - inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label); + inode = nfs_fhget(dentry->d_sb, fhandle, fattr, fattr->label); res = ERR_CAST(inode); if (IS_ERR(res)) - goto out_label; + goto out; /* Notify readdir to use READDIRPLUS */ nfs_force_use_readdirplus(dir); @@ -1800,14 +1792,12 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in res = d_splice_alias(inode, dentry); if (res != NULL) { if (IS_ERR(res)) - goto out_label; + goto out; dentry = res; } nfs_set_verifier(dentry, dir_verifier); -out_label: +out: trace_nfs_lookup_exit(dir, dentry, flags, error); - nfs4_label_free(label); -out: nfs_free_fattr(fattr); nfs_free_fhandle(fhandle); return res; @@ -2056,7 +2046,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle, d_drop(dentry); if (fhandle->size == 0) { - error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, NULL); + error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr); if (error) goto out_error; } diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index bc0c698f3350..3295af4110f1 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -308,8 +308,7 @@ int nfs_submount(struct fs_context *fc, struct nfs_server *server) /* Look it up again to get its attributes */ err = server->nfs_client->rpc_ops->lookup(d_inode(parent), dentry, - ctx->mntfh, ctx->clone_data.fattr, - NULL); + ctx->mntfh, ctx->clone_data.fattr); dput(parent); if (err != 0) return err; diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index f7524310ddf4..717eb651f0fd 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c @@ -193,8 +193,7 @@ __nfs3_proc_lookup(struct inode *dir, const char *name, size_t len, static int nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, - struct nfs_fh *fhandle, struct nfs_fattr *fattr, - struct nfs4_label *label) + struct nfs_fh *fhandle, struct nfs_fattr *fattr) { unsigned short task_flags = 0; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index fed15eafc03b..49e077841e98 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4295,7 +4295,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct dentry *dentry, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label) + struct nfs_fattr *fattr) { struct nfs_server *server = NFS_SERVER(dir); int status; @@ -4307,7 +4307,6 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct nfs4_lookup_res res = { .server = server, .fattr = fattr, - .label = label, .fh = fhandle, }; struct rpc_message msg = { @@ -4324,7 +4323,7 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, if (nfs_lookup_is_soft_revalidate(dentry)) task_flags |= RPC_TASK_TIMEOUT; - args.bitmask = nfs4_bitmask(server, label); + args.bitmask = nfs4_bitmask(server, fattr->label); nfs_fattr_init(fattr); @@ -4346,7 +4345,7 @@ static void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr) static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, struct dentry *dentry, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label) + struct nfs_fattr *fattr) { struct nfs4_exception exception = { .interruptible = true, @@ -4355,7 +4354,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, const struct qstr *name = &dentry->d_name; int err; do { - err = _nfs4_proc_lookup(client, dir, dentry, fhandle, fattr, label); + err = _nfs4_proc_lookup(client, dir, dentry, fhandle, fattr); trace_nfs4_lookup(dir, name, err); switch (err) { case -NFS4ERR_BADNAME: @@ -4391,13 +4390,12 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, } static int nfs4_proc_lookup(struct inode *dir, struct dentry *dentry, - struct nfs_fh *fhandle, struct nfs_fattr *fattr, - struct nfs4_label *label) + struct nfs_fh *fhandle, struct nfs_fattr *fattr) { int status; struct rpc_clnt *client = NFS_CLIENT(dir); - status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr, label); + status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr); if (client != NFS_CLIENT(dir)) { rpc_shutdown_client(client); nfs_fixup_secinfo_attributes(fattr); @@ -4412,7 +4410,7 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct dentry *dentry, struct rpc_clnt *client = NFS_CLIENT(dir); int status; - status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr, NULL); + status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr); if (status < 0) return ERR_PTR(status); return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client; diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 4ce6d2430ff1..fc5c987d8ad9 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -6179,7 +6179,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_getfh(xdr, res->fh); if (status) goto out; - status = decode_getfattr_label(xdr, res->fattr, res->label, res->server); + status = decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); out: return status; } @@ -6237,7 +6237,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, status = decode_getfh(xdr, res->fh); if (status == 0) status = decode_getfattr_label(xdr, res->fattr, - res->label, res->server); + res->fattr->label, res->server); out: return status; } diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index ea19dbf12301..408507e9354c 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -154,8 +154,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, static int nfs_proc_lookup(struct inode *dir, struct dentry *dentry, - struct nfs_fh *fhandle, struct nfs_fattr *fattr, - struct nfs4_label *label) + struct nfs_fh *fhandle, struct nfs_fattr *fattr) { struct nfs_diropargs arg = { .fh = NFS_FH(dir), diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index d55bf3fd5167..95219d5a8668 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1095,7 +1095,6 @@ struct nfs4_lookup_res { const struct nfs_server * server; struct nfs_fattr * fattr; struct nfs_fh * fh; - struct nfs4_label *label; }; struct nfs4_lookupp_arg { @@ -1740,8 +1739,7 @@ struct nfs_rpc_ops { int (*setattr) (struct dentry *, struct nfs_fattr *, struct iattr *); int (*lookup) (struct inode *, struct dentry *, - struct nfs_fh *, struct nfs_fattr *, - struct nfs4_label *); + struct nfs_fh *, struct nfs_fattr *); int (*lookupp) (struct inode *, struct nfs_fh *, struct nfs_fattr *, struct nfs4_label *); int (*access) (struct inode *, struct nfs_access_entry *); From patchwork Fri Oct 22 17:11:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3618CC433EF for ; Fri, 22 Oct 2021 17:11:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20C486120D for ; Fri, 22 Oct 2021 17:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233836AbhJVRNu (ORCPT ); Fri, 22 Oct 2021 13:13:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233956AbhJVRNg (ORCPT ); Fri, 22 Oct 2021 13:13:36 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CBB0C061767 for ; Fri, 22 Oct 2021 10:11:19 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id r15so5201375qkp.8 for ; Fri, 22 Oct 2021 10:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gUY6Pr0LbnVoGK2T5GCq7km/HYAYOUWqp0fq63GehQI=; b=pHySW19zKRbgOeTLt+pgA9zDWfaAA3L2x0dg5mYy8jLSYiuRPEwEi7qpBao+HMOWP7 yxmKjHJXbvz10RWA4oeakp6lxHfIqxIPYKKze2O9Hey3DqPXDutQiC8trFR+sWGBc5+r bWfAKv6k1zpRRCMs3jCeDTgmCbB+i68tksLUZ7IE3rWpk/cb1YSibyxefxCpkdAQOnKb HqMiBjnjTsWnl14tyHvzoMBMwy8osS42QcbLgrv+GSxJC4rqE8z8+BndBaf7YL4Y3THf gXM6rcQW/QYOyg/hsBSmWwKTsYr5Zop0A3o0zjyj2FVhAyTAzvaik9yCo+WsULONfWlV 9vvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gUY6Pr0LbnVoGK2T5GCq7km/HYAYOUWqp0fq63GehQI=; b=GSN0vNZXqv/lFkKlKHoPlCTf+WI9LvbI+lxAD4UaFqp9kM41M1SbsmQg0vqjsO4gfw x8MerI5u7RmANj3SoBBRMvu3MKQUYYeLdvMEp7Z/3jP5hjDBpnK00hJxRsgEEHFHe+Lr VxI4Njo5uWANVFCgVyru3LmrFIkZdseD09n020EyEkXH7UD6NuwujXVbYI2uF6upSjxc M5WZzgap1PwN5b5vIfUx8kMnuoEPvRPAFjVgchzMfUb6Aem8o/kDocXNXD1QuBSmzYbo UOLcU/D/inXIqFrstL09jZn8OPE6NaYkKiXETp2AFSZ6ymP4WP4xep71DU2JmcjmbPE5 f8CQ== X-Gm-Message-State: AOAM5335GWQUrhZdPI0pKNrnmAPeAeYPg6vvs7A31mWjOBG6J9CEc9+Y cfqbu6qnsa2mVV8NL3M/5DI= X-Google-Smtp-Source: ABdhPJyYIY13c9QMtSd7k0DBVVcHYAb6oz72nYJaUYsV78YqMgH/LChZbScFC19G8q20xCJnBSv4Gg== X-Received: by 2002:a37:a5d1:: with SMTP id o200mr1136919qke.30.1634922678147; Fri, 22 Oct 2021 10:11:18 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:17 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 06/14] NFS: Remove the nfs4_label from the nfs4_lookupp_res struct Date: Fri, 22 Oct 2021 13:11:05 -0400 Message-Id: <20211022171113.16739-7-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Signed-off-by: Anna Schumaker --- fs/nfs/export.c | 26 +++++++------------------- fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 10 ++++------ fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 3 +-- 5 files changed, 14 insertions(+), 29 deletions(-) diff --git a/fs/nfs/export.c b/fs/nfs/export.c index d772c20bbfd1..895b404888dd 100644 --- a/fs/nfs/export.c +++ b/fs/nfs/export.c @@ -131,7 +131,6 @@ nfs_get_parent(struct dentry *dentry) struct super_block *sb = inode->i_sb; struct nfs_server *server = NFS_SB(sb); struct nfs_fattr *fattr = NULL; - struct nfs4_label *label = NULL; struct dentry *parent; struct nfs_rpc_ops const *ops = server->nfs_client->rpc_ops; struct nfs_fh fh; @@ -139,31 +138,20 @@ nfs_get_parent(struct dentry *dentry) if (!ops->lookupp) return ERR_PTR(-EACCES); - fattr = nfs_alloc_fattr(); - if (fattr == NULL) { - parent = ERR_PTR(-ENOMEM); - goto out; - } + fattr = nfs_alloc_fattr_with_label(server); + if (fattr == NULL) + return ERR_PTR(-ENOMEM); - label = nfs4_label_alloc(server, GFP_KERNEL); - if (IS_ERR(label)) { - parent = ERR_CAST(label); - goto out_free_fattr; - } - - ret = ops->lookupp(inode, &fh, fattr, label); + ret = ops->lookupp(inode, &fh, fattr); if (ret) { parent = ERR_PTR(ret); - goto out_free_label; + goto out; } - pinode = nfs_fhget(sb, &fh, fattr, label); + pinode = nfs_fhget(sb, &fh, fattr, fattr->label); parent = d_obtain_alias(pinode); -out_free_label: - nfs4_label_free(label); -out_free_fattr: - nfs_free_fattr(fattr); out: + nfs_free_fattr(fattr); return parent; } diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 717eb651f0fd..516f3340b226 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c @@ -208,7 +208,7 @@ nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, } static int nfs3_proc_lookupp(struct inode *inode, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label) + struct nfs_fattr *fattr) { const char dotdot[] = ".."; const size_t len = strlen(dotdot); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 49e077841e98..7e02c698c60f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4417,8 +4417,7 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct dentry *dentry, } static int _nfs4_proc_lookupp(struct inode *inode, - struct nfs_fh *fhandle, struct nfs_fattr *fattr, - struct nfs4_label *label) + struct nfs_fh *fhandle, struct nfs_fattr *fattr) { struct rpc_clnt *clnt = NFS_CLIENT(inode); struct nfs_server *server = NFS_SERVER(inode); @@ -4430,7 +4429,6 @@ static int _nfs4_proc_lookupp(struct inode *inode, struct nfs4_lookupp_res res = { .server = server, .fattr = fattr, - .label = label, .fh = fhandle, }; struct rpc_message msg = { @@ -4443,7 +4441,7 @@ static int _nfs4_proc_lookupp(struct inode *inode, if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL) task_flags |= RPC_TASK_TIMEOUT; - args.bitmask = nfs4_bitmask(server, label); + args.bitmask = nfs4_bitmask(server, fattr->label); nfs_fattr_init(fattr); @@ -4455,14 +4453,14 @@ static int _nfs4_proc_lookupp(struct inode *inode, } static int nfs4_proc_lookupp(struct inode *inode, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label) + struct nfs_fattr *fattr) { struct nfs4_exception exception = { .interruptible = true, }; int err; do { - err = _nfs4_proc_lookupp(inode, fhandle, fattr, label); + err = _nfs4_proc_lookupp(inode, fhandle, fattr); trace_nfs4_lookupp(inode, err); err = nfs4_handle_exception(NFS_SERVER(inode), err, &exception); diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index fc5c987d8ad9..77467216cd5d 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -6209,7 +6209,7 @@ static int nfs4_xdr_dec_lookupp(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_getfh(xdr, res->fh); if (status) goto out; - status = decode_getfattr_label(xdr, res->fattr, res->label, res->server); + status = decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); out: return status; } diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 95219d5a8668..f0a685d9b8bd 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1108,7 +1108,6 @@ struct nfs4_lookupp_res { const struct nfs_server *server; struct nfs_fattr *fattr; struct nfs_fh *fh; - struct nfs4_label *label; }; struct nfs4_lookup_root_arg { @@ -1741,7 +1740,7 @@ struct nfs_rpc_ops { int (*lookup) (struct inode *, struct dentry *, struct nfs_fh *, struct nfs_fattr *); int (*lookupp) (struct inode *, struct nfs_fh *, - struct nfs_fattr *, struct nfs4_label *); + struct nfs_fattr *); int (*access) (struct inode *, struct nfs_access_entry *); int (*readlink)(struct inode *, struct page *, unsigned int, unsigned int); From patchwork Fri Oct 22 17:11:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CDD4C43217 for ; Fri, 22 Oct 2021 17:11:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86419611CB for ; Fri, 22 Oct 2021 17:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233898AbhJVRNv (ORCPT ); Fri, 22 Oct 2021 13:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233959AbhJVRNh (ORCPT ); Fri, 22 Oct 2021 13:13:37 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAF7DC061764 for ; Fri, 22 Oct 2021 10:11:19 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id bp7so5119622qkb.12 for ; Fri, 22 Oct 2021 10:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d5N3AfRAvYyr/UvisvfMD2/7lmSl+sDcEXjF+9sw3MY=; b=DACU0M3r7MJD7I2VMyV+MEBVVjX/EYp/YZtWBI7dxQvXk8A2ysRc2P8L06f8QPlEx3 ct8twByw/FAoaXQsu4PjdyBAWqkQrT8yGw+QnuxzfhhyjFgqwTbLIkuvrsTOspWvHE3w wohlZjR1A6jC5QmayHgfeN/46+mTM9yVibNPyqkxUAjauH2w568+G8spwwAGIGd0Fdn6 2sDJTI149SgI7QEStb/IWjhdy1o+XsDTWfQnIZ8Nybs9yVSlNFXJQFLnSpIxRRUNt0pt Im8PDLBPqFC7eVs+uoahmeVGQsBFOBnaiPcUN9hS+4EpsLUiuJwl5hfDgJzig4FreJJ+ l7hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=d5N3AfRAvYyr/UvisvfMD2/7lmSl+sDcEXjF+9sw3MY=; b=MMkzH6vbkVlz782o8nJrxI8YrDVJRvzdPbNZ5VP50RzeCMGf/lP8nZN6BjXBu8WY1f ViS7LSRr/wlsSMj8g8uJW8UsLNdrS9ITmFJr0YeeJztWYgPlilG+oBWCmJ6QWopoSLVx 8tktdW7SfSy9NCK7uJ4ig3hFzIi7d8uuFeVFCW5+1VE4sHkF3hTER214DPhu914NrNwp 8Soiwr8EuzdKRjkXiiS1uJ2s5JoUTkSssnjhoBC/jdweTPtBthuMRPt9DmewP0ex7/cl EkAryTGWmTBTrGs1RXkk0KE2raUrSwdPSiKg0lc6J8gzSURToVGEyA9aHER4CERqoBQ2 Ua/Q== X-Gm-Message-State: AOAM532YZh5DeW9BHnfNyhsDHTnaZKCmOqL5WKepZVBm6rzMk2ThBnrX Hpjy5s0Ffn3IuTR7QKFWC20= X-Google-Smtp-Source: ABdhPJxjoegyfaeCTMnbxDCOHCeMQaeqta4+lzW2pMJF6OsxKXDuG0PVgeuY9NlT5T6gdEtP5iZIMA== X-Received: by 2002:a05:620a:2481:: with SMTP id i1mr1112984qkn.286.1634922678795; Fri, 22 Oct 2021 10:11:18 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:18 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 07/14] NFS: Remove the f_label from the nfs4_opendata and nfs_openres Date: Fri, 22 Oct 2021 13:11:06 -0400 Message-Id: <20211022171113.16739-8-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Signed-off-by: Anna Schumaker --- fs/nfs/nfs4_fs.h | 1 - fs/nfs/nfs4proc.c | 35 +++++++++++------------------------ fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 4 files changed, 12 insertions(+), 27 deletions(-) diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index ba78df4b13d9..b621e29e6187 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -234,7 +234,6 @@ struct nfs4_opendata { struct nfs4_string group_name; struct nfs4_label *a_label; struct nfs_fattr f_attr; - struct nfs4_label *f_label; struct dentry *dir; struct dentry *dentry; struct nfs4_state_owner *owner; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 7e02c698c60f..51b86de47b60 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1329,7 +1329,6 @@ nfs4_map_atomic_open_claim(struct nfs_server *server, static void nfs4_init_opendata_res(struct nfs4_opendata *p) { p->o_res.f_attr = &p->f_attr; - p->o_res.f_label = p->f_label; p->o_res.seqid = p->o_arg.seqid; p->c_res.seqid = p->c_arg.seqid; p->o_res.server = p->o_arg.server; @@ -1355,8 +1354,8 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, if (p == NULL) goto err; - p->f_label = nfs4_label_alloc(server, gfp_mask); - if (IS_ERR(p->f_label)) + p->f_attr.label = nfs4_label_alloc(server, gfp_mask); + if (IS_ERR(p->f_attr.label)) goto err_free_p; p->a_label = nfs4_label_alloc(server, gfp_mask); @@ -1439,7 +1438,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, err_free_label: nfs4_label_free(p->a_label); err_free_f: - nfs4_label_free(p->f_label); + nfs4_label_free(p->f_attr.label); err_free_p: kfree(p); err: @@ -1461,7 +1460,7 @@ static void nfs4_opendata_free(struct kref *kref) nfs4_put_state_owner(p->owner); nfs4_label_free(p->a_label); - nfs4_label_free(p->f_label); + nfs4_label_free(p->f_attr.label); dput(p->dir); dput(p->dentry); @@ -2013,7 +2012,7 @@ nfs4_opendata_get_inode(struct nfs4_opendata *data) if (!(data->f_attr.valid & NFS_ATTR_FATTR)) return ERR_PTR(-EAGAIN); inode = nfs_fhget(data->dir->d_sb, &data->o_res.fh, - &data->f_attr, data->f_label); + &data->f_attr, data->f_attr.label); break; default: inode = d_inode(data->dentry); @@ -2709,7 +2708,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data, if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) { nfs4_sequence_free_slot(&o_res->seq_res); nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, - o_res->f_label, NULL); + o_res->f_attr->label, NULL); } return 0; } @@ -3125,7 +3124,6 @@ static int _nfs4_do_open(struct inode *dir, enum open_claim_type4 claim = NFS4_OPEN_CLAIM_NULL; struct iattr *sattr = c->sattr; struct nfs4_label *label = c->label; - struct nfs4_label *olabel = NULL; int status; /* Protect against reboot recovery conflicts */ @@ -3148,19 +3146,11 @@ static int _nfs4_do_open(struct inode *dir, if (opendata == NULL) goto err_put_state_owner; - if (label) { - olabel = nfs4_label_alloc(server, GFP_KERNEL); - if (IS_ERR(olabel)) { - status = PTR_ERR(olabel); - goto err_opendata_put; - } - } - if (server->attr_bitmask[2] & FATTR4_WORD2_MDSTHRESHOLD) { if (!opendata->f_attr.mdsthreshold) { opendata->f_attr.mdsthreshold = pnfs_mdsthreshold_alloc(); if (!opendata->f_attr.mdsthreshold) - goto err_free_label; + goto err_opendata_put; } opendata->o_arg.open_bitmap = &nfs4_pnfs_open_bitmap[0]; } @@ -3169,7 +3159,7 @@ static int _nfs4_do_open(struct inode *dir, status = _nfs4_open_and_get_state(opendata, flags, ctx); if (status != 0) - goto err_free_label; + goto err_opendata_put; state = ctx->state; if ((opendata->o_arg.open_flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) && @@ -3186,11 +3176,12 @@ static int _nfs4_do_open(struct inode *dir, nfs_fattr_init(opendata->o_res.f_attr); status = nfs4_do_setattr(state->inode, cred, opendata->o_res.f_attr, sattr, - ctx, label, olabel); + ctx, label, opendata->o_res.f_attr->label); if (status == 0) { nfs_setattr_update_inode(state->inode, sattr, opendata->o_res.f_attr); - nfs_setsecurity(state->inode, opendata->o_res.f_attr, olabel); + nfs_setsecurity(state->inode, opendata->o_res.f_attr, + opendata->o_res.f_attr->label); } sattr->ia_valid = ia_old; } @@ -3203,13 +3194,9 @@ static int _nfs4_do_open(struct inode *dir, opendata->f_attr.mdsthreshold = NULL; } - nfs4_label_free(olabel); - nfs4_opendata_put(opendata); nfs4_put_state_owner(sp); return 0; -err_free_label: - nfs4_label_free(olabel); err_opendata_put: nfs4_opendata_put(opendata); err_put_state_owner: diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 77467216cd5d..8d9d4df75f88 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -6532,7 +6532,7 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr, goto out; if (res->access_request) decode_access(xdr, &res->access_supported, &res->access_result); - decode_getfattr_label(xdr, res->f_attr, res->f_label, res->server); + decode_getfattr_label(xdr, res->f_attr, res->f_attr->label, res->server); if (res->lg_res) decode_layoutget(xdr, rqstp, res->lg_res); out: diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index f0a685d9b8bd..cb28e01ea41e 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -488,7 +488,6 @@ struct nfs_openres { struct nfs4_change_info cinfo; __u32 rflags; struct nfs_fattr * f_attr; - struct nfs4_label *f_label; struct nfs_seqid * seqid; const struct nfs_server *server; fmode_t delegation_type; From patchwork Fri Oct 22 17:11:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0C3AC433FE for ; Fri, 22 Oct 2021 17:11:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87EF6611F2 for ; Fri, 22 Oct 2021 17:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233855AbhJVRNw (ORCPT ); Fri, 22 Oct 2021 13:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233961AbhJVRNi (ORCPT ); Fri, 22 Oct 2021 13:13:38 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59DC9C061766 for ; Fri, 22 Oct 2021 10:11:20 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id k29so2846421qve.6 for ; Fri, 22 Oct 2021 10:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=98iznrXyfh8l73YhtCVWp+OfnflrSOZ8i2XhOhQ55oI=; b=WbtKaRuh79gsKA6gIuzmdftQKq9lfOaGGwEVPkRkXlDWfz1jThZcveC6+bCF2smCf0 7NJGykjlFpVabe/SVjARzn6BjtxZYCFctxj1w8nwE4m8mPJd5PhGSVw0niVdtyrfZWmx Hzkt3BddWLCPUIIs4R1shPu/BEQNTstzpaba04Xydzrmg4C3iDe2O0YIfNlBkQPZrxj4 qMvd0C27Z2kUS5q3ANjNHhbDaz0JbWt9yu+YVS/Pxj/SQ550wCwGqBDXClcUGmkZ0g8E pS8SZysqTQTHHycrMvYJyXig1iyQSRoQibjYhBAER/iNtuLLgL0AN9ll3jG6tGa6LT/R 03GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=98iznrXyfh8l73YhtCVWp+OfnflrSOZ8i2XhOhQ55oI=; b=A1SIa857gqIjcj+4E352KjW8Ny+xHJorhNvHiPhhJx0yQO6bHc76cWcqpznk+tgAPX rjNBQXvy3kCZJe9B4/j0yI3H7ycltJjuL8k/gvWw4zQsYj9w6+7L+wP5BBvJOHEbJZwe OVn//bc7ycYZRqvrDiDG1ahzGTMbb2eZVDreCKYD8EOmHTdC3ACER2/Kvozo34FXGtOV /YAu8PxFepefGEPGj7TmAMywEYUf2musVjEPzBksPanciwRMUxpJ9tie6ad0XD0+kMwy RgQvvvaK6Lk1VdSA0jUC0ptLVCJi9TNM+gwQFGJbQIpB0bp27aCkTKWr089+zniWAJ6i rfeA== X-Gm-Message-State: AOAM532d2mSPy/Jof4sicjGL3H3i3PZ3E04SCksL6BPQShrRCf51MmJR PVts1PDwCYXTUqF1DCWTb9A= X-Google-Smtp-Source: ABdhPJz4n6lI/KWKD4E1Vi8PmEZmSL++Eio9puqbuXnfWGQP2u+0AQb0uLfoFOZNZUzyhnYV9PeH6A== X-Received: by 2002:a0c:fb0d:: with SMTP id c13mr1267744qvp.25.1634922679394; Fri, 22 Oct 2021 10:11:19 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:19 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 08/14] NFS: Remove the nfs4_label from the nfs4_getattr_res Date: Fri, 22 Oct 2021 13:11:07 -0400 Message-Id: <20211022171113.16739-9-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Signed-off-by: Anna Schumaker --- fs/nfs/client.c | 2 +- fs/nfs/dir.c | 2 +- fs/nfs/export.c | 18 ++++-------------- fs/nfs/inode.c | 20 +++++--------------- fs/nfs/nfs3proc.c | 3 +-- fs/nfs/nfs4_fs.h | 3 +-- fs/nfs/nfs4file.c | 2 +- fs/nfs/nfs4proc.c | 25 +++++++++++-------------- fs/nfs/nfs4xdr.c | 2 +- fs/nfs/proc.c | 3 +-- include/linux/nfs_xdr.h | 4 +--- 11 files changed, 28 insertions(+), 56 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 23e165d5ec9c..6956079b7741 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1025,7 +1025,7 @@ struct nfs_server *nfs_create_server(struct fs_context *fc) if (!(fattr->valid & NFS_ATTR_FATTR)) { error = ctx->nfs_mod->rpc_ops->getattr(server, ctx->mntfh, - fattr, NULL, NULL); + fattr, NULL); if (error < 0) { dprintk("nfs_create_server: getattr error = %d\n", -error); goto error; diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 5f6996ee46be..7692d932add9 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2054,7 +2054,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle, if (!(fattr->valid & NFS_ATTR_FATTR)) { struct nfs_server *server = NFS_SB(dentry->d_sb); error = server->nfs_client->rpc_ops->getattr(server, fhandle, - fattr, NULL, NULL); + fattr, NULL); if (error < 0) goto out_error; } diff --git a/fs/nfs/export.c b/fs/nfs/export.c index 895b404888dd..a0462f7e7e35 100644 --- a/fs/nfs/export.c +++ b/fs/nfs/export.c @@ -64,7 +64,6 @@ static struct dentry * nfs_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { - struct nfs4_label *label = NULL; struct nfs_fattr *fattr = NULL; struct nfs_fh *server_fh = nfs_exp_embedfh(fid->raw); size_t fh_size = offsetof(struct nfs_fh, data) + server_fh->size; @@ -79,7 +78,7 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid, if (fh_len < len || fh_type != len) return NULL; - fattr = nfs_alloc_fattr(); + fattr = nfs_alloc_fattr_with_label(NFS_SB(sb)); if (fattr == NULL) { dentry = ERR_PTR(-ENOMEM); goto out; @@ -95,28 +94,19 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid, if (inode) goto out_found; - label = nfs4_label_alloc(NFS_SB(sb), GFP_KERNEL); - if (IS_ERR(label)) { - dentry = ERR_CAST(label); - goto out_free_fattr; - } - rpc_ops = NFS_SB(sb)->nfs_client->rpc_ops; - ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, label, NULL); + ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, NULL); if (ret) { dprintk("%s: getattr failed %d\n", __func__, ret); trace_nfs_fh_to_dentry(sb, server_fh, fattr->fileid, ret); dentry = ERR_PTR(ret); - goto out_free_label; + goto out_free_fattr; } - inode = nfs_fhget(sb, server_fh, fattr, label); + inode = nfs_fhget(sb, server_fh, fattr, fattr->label); out_found: dentry = d_obtain_alias(inode); - -out_free_label: - nfs4_label_free(label); out_free_fattr: nfs_free_fattr(fattr); out: diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 309a8921eea3..73edabb00a9d 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1175,7 +1175,6 @@ int __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) { int status = -ESTALE; - struct nfs4_label *label = NULL; struct nfs_fattr *fattr = NULL; struct nfs_inode *nfsi = NFS_I(inode); @@ -1197,20 +1196,13 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) } status = -ENOMEM; - fattr = nfs_alloc_fattr(); + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); if (fattr == NULL) goto out; nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); - label = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); - if (IS_ERR(label)) { - status = PTR_ERR(label); - goto out; - } - - status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr, - label, inode); + status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr, inode); if (status != 0) { dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) getattr failed, error=%d\n", inode->i_sb->s_id, @@ -1227,7 +1219,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) else nfs_zap_caches(inode); } - goto err_out; + goto out; } status = nfs_refresh_inode(inode, fattr); @@ -1235,20 +1227,18 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) refresh failed, error=%d\n", inode->i_sb->s_id, (unsigned long long)NFS_FILEID(inode), status); - goto err_out; + goto out; } if (nfsi->cache_validity & NFS_INO_INVALID_ACL) nfs_zap_acl_cache(inode); - nfs_setsecurity(inode, fattr, label); + nfs_setsecurity(inode, fattr, fattr->label); dfprintk(PAGECACHE, "NFS: (%s/%Lu) revalidation complete\n", inode->i_sb->s_id, (unsigned long long)NFS_FILEID(inode)); -err_out: - nfs4_label_free(label); out: nfs_free_fattr(fattr); trace_nfs_revalidate_inode_exit(inode, status); diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 516f3340b226..7bae21a2ba05 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c @@ -100,8 +100,7 @@ nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, */ static int nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label, - struct inode *inode) + struct nfs_fattr *fattr, struct inode *inode) { struct rpc_message msg = { .rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR], diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index b621e29e6187..ed5eaca6801e 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -316,8 +316,7 @@ extern int nfs4_set_rw_stateid(nfs4_stateid *stateid, const struct nfs_lock_context *l_ctx, fmode_t fmode); extern int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label, - struct inode *inode); + struct nfs_fattr *fattr, struct inode *inode); extern int update_open_stateid(struct nfs4_state *state, const nfs4_stateid *open_stateid, const nfs4_stateid *deleg_stateid, diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index c91565227ea2..ef78e06bcd21 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -330,7 +330,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt, nfs_fattr_init(&fattr); - status = nfs4_proc_getattr(server, src_fh, &fattr, NULL, NULL); + status = nfs4_proc_getattr(server, src_fh, &fattr, NULL); if (status < 0) { res = ERR_PTR(status); goto out; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 51b86de47b60..7b9aecd20744 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -93,7 +93,8 @@ struct nfs4_opendata; static int _nfs4_recover_proc_open(struct nfs4_opendata *data); static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr); -static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs4_label *label, struct inode *inode); +static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, + struct nfs_fattr *fattr, struct inode *inode); static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, struct nfs_fattr *fattr, struct iattr *sattr, struct nfs_open_context *ctx, struct nfs4_label *ilabel, @@ -2707,8 +2708,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data, } if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) { nfs4_sequence_free_slot(&o_res->seq_res); - nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, - o_res->f_attr->label, NULL); + nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, NULL); } return 0; } @@ -4091,7 +4091,6 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *mntfh, { int error; struct nfs_fattr *fattr = info->fattr; - struct nfs4_label *label = fattr->label; error = nfs4_server_capabilities(server, mntfh); if (error < 0) { @@ -4099,7 +4098,7 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *mntfh, return error; } - error = nfs4_proc_getattr(server, mntfh, fattr, label, NULL); + error = nfs4_proc_getattr(server, mntfh, fattr, NULL); if (error < 0) { dprintk("nfs4_get_root: getattr error = %d\n", -error); goto out; @@ -4162,8 +4161,7 @@ static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir, } static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label, - struct inode *inode) + struct nfs_fattr *fattr, struct inode *inode) { __u32 bitmask[NFS4_BITMASK_SZ]; struct nfs4_getattr_arg args = { @@ -4172,7 +4170,6 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, }; struct nfs4_getattr_res res = { .fattr = fattr, - .label = label, .server = server, }; struct rpc_message msg = { @@ -4189,7 +4186,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, if (inode && (server->flags & NFS_MOUNT_SOFTREVAL)) task_flags |= RPC_TASK_TIMEOUT; - nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, label), inode, 0); + nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, fattr->label), inode, 0); nfs_fattr_init(fattr); nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 0); return nfs4_do_call_sync(server->client, server, &msg, @@ -4197,15 +4194,14 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, } int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label, - struct inode *inode) + struct nfs_fattr *fattr, struct inode *inode) { struct nfs4_exception exception = { .interruptible = true, }; int err; do { - err = _nfs4_proc_getattr(server, fhandle, fattr, label, inode); + err = _nfs4_proc_getattr(server, fhandle, fattr, inode); trace_nfs4_getattr(server, fhandle, fattr, err); err = nfs4_handle_exception(server, err, &exception); @@ -5975,17 +5971,18 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, size_t buflen) { struct nfs_server *server = NFS_SERVER(inode); - struct nfs_fattr fattr; struct nfs4_label label = {0, 0, buflen, buf}; u32 bitmask[3] = { 0, 0, FATTR4_WORD2_SECURITY_LABEL }; + struct nfs_fattr fattr = { + .label = &label, + }; struct nfs4_getattr_arg arg = { .fh = NFS_FH(inode), .bitmask = bitmask, }; struct nfs4_getattr_res res = { .fattr = &fattr, - .label = &label, .server = server, }; struct rpc_message msg = { diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 8d9d4df75f88..b002a39d39ea 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -6394,7 +6394,7 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_putfh(xdr); if (status) goto out; - status = decode_getfattr_label(xdr, res->fattr, res->label, res->server); + status = decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); out: return status; } diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 408507e9354c..d941cd0fe34d 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -100,8 +100,7 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, */ static int nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct nfs4_label *label, - struct inode *inode) + struct nfs_fattr *fattr, struct inode *inode) { struct rpc_message msg = { .rpc_proc = &nfs_procedures[NFSPROC_GETATTR], diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index cb28e01ea41e..817f1bf5f187 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1063,7 +1063,6 @@ struct nfs4_getattr_res { struct nfs4_sequence_res seq_res; const struct nfs_server * server; struct nfs_fattr * fattr; - struct nfs4_label *label; }; struct nfs4_link_arg { @@ -1732,8 +1731,7 @@ struct nfs_rpc_ops { int (*submount) (struct fs_context *, struct nfs_server *); int (*try_get_tree) (struct fs_context *); int (*getattr) (struct nfs_server *, struct nfs_fh *, - struct nfs_fattr *, struct nfs4_label *, - struct inode *); + struct nfs_fattr *, struct inode *); int (*setattr) (struct dentry *, struct nfs_fattr *, struct iattr *); int (*lookup) (struct inode *, struct dentry *, From patchwork Fri Oct 22 17:11:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42D40C433EF for ; Fri, 22 Oct 2021 17:11:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A2D7611CB for ; Fri, 22 Oct 2021 17:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233853AbhJVRNw (ORCPT ); Fri, 22 Oct 2021 13:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233965AbhJVRNi (ORCPT ); Fri, 22 Oct 2021 13:13:38 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD397C061764 for ; Fri, 22 Oct 2021 10:11:20 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id bp7so5119667qkb.12 for ; Fri, 22 Oct 2021 10:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=im5gNdi/BYCmkzFIwwDZYBuPYVM44ZJF52eTBUgQ6gA=; b=qVmGEBD10BoeJMGLTywSdYt7ei8VIbahCYbUZk1KVEFRynIJ9n186+iKM2vmiM7grX fVD8dHXaeImOIYGyZ9Nz1OrZORNd+mk1GJxCRmbM4YdwE01WOJsVEvHJWvc9tx5kCOLd GgxlQ3a1zYr6LziWxWDCardmAVCFctnNT9AHByT4kY3NOa3+R7n7PdtEZLXudEAoXhqe N7s38k+wbXfQ/zYtecNWU2odWOzct71NAq/C9gUsJqaa/CqR2zKd1zCyd7b/Sza0snbA Yep9GFUQxs16sH9uFJU0krCqbPMtDr0WjS8CD+dnwXlOtCVVlnzrVG8vO8ArLYfVx+MZ xEOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=im5gNdi/BYCmkzFIwwDZYBuPYVM44ZJF52eTBUgQ6gA=; b=TaFt9YyDp8vM126qMAAD3ofKaGsV3YPDxE0vJHkqCgvH9FG8g38O1bIUpCUz7uqCIK 8e1+GKHaCgRyuEfwyxsUXSk5i6xeHDAuMZhSO6akcr0unM4D1Kdan4LgAlljCN2PJqED 2HVKfxutMcslTcvueDtAulqvEo21GVtjDuiqlQxKcOvWeGhy0PTxJmIdeL2i+wNioDUa fF0yGe4uNrQIovyk2bdJLKAQosFlw5vx5Q/n5EABroxRK2IMF0JAXIISmnKPPvWLtjMA ShZXgM5KUJ2SZB82WPaEcPfEKnQC3li31biODDFnk+3T5Djl+4PJ5/prC0Z0c1msZLgG ycEQ== X-Gm-Message-State: AOAM531EzK9NtVrfyVDhjVOktzvLoBgqxgfIg367frwH81modh6LH7nD pkCIo0rTmdvjZtsD3drFU4o= X-Google-Smtp-Source: ABdhPJzP8iEWEHon+ZpvDzcmmvj5OfivwL3dcnQnBD/wyr/aSQ6lAw5j/Xax55YcQLI2JtrmI2cwHw== X-Received: by 2002:a05:620a:1aa1:: with SMTP id bl33mr1041408qkb.411.1634922680016; Fri, 22 Oct 2021 10:11:20 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:19 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 09/14] NFS: Remove the nfs4_label from the nfs_setattrres Date: Fri, 22 Oct 2021 13:11:08 -0400 Message-Id: <20211022171113.16739-10-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Signed-off-by: Anna Schumaker --- fs/nfs/inode.c | 2 +- fs/nfs/nfs4proc.c | 56 ++++++++++++----------------------------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 4 files changed, 18 insertions(+), 43 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 73edabb00a9d..99ee138a0a5e 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -632,7 +632,7 @@ nfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, if (S_ISREG(inode->i_mode)) nfs_sync_inode(inode); - fattr = nfs_alloc_fattr(); + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); if (fattr == NULL) { error = -ENOMEM; goto out; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 7b9aecd20744..a3b204f2f85c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -97,8 +97,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct inode *inode); static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, struct nfs_fattr *fattr, struct iattr *sattr, - struct nfs_open_context *ctx, struct nfs4_label *ilabel, - struct nfs4_label *olabel); + struct nfs_open_context *ctx, struct nfs4_label *ilabel); #ifdef CONFIG_NFS_V4_1 static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, const struct cred *cred, @@ -3176,7 +3175,7 @@ static int _nfs4_do_open(struct inode *dir, nfs_fattr_init(opendata->o_res.f_attr); status = nfs4_do_setattr(state->inode, cred, opendata->o_res.f_attr, sattr, - ctx, label, opendata->o_res.f_attr->label); + ctx, label); if (status == 0) { nfs_setattr_update_inode(state->inode, sattr, opendata->o_res.f_attr); @@ -3341,8 +3340,7 @@ static int _nfs4_do_setattr(struct inode *inode, static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, struct nfs_fattr *fattr, struct iattr *sattr, - struct nfs_open_context *ctx, struct nfs4_label *ilabel, - struct nfs4_label *olabel) + struct nfs_open_context *ctx, struct nfs4_label *ilabel) { struct nfs_server *server = NFS_SERVER(inode); __u32 bitmask[NFS4_BITMASK_SZ]; @@ -3356,7 +3354,6 @@ static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, }; struct nfs_setattrres res = { .fattr = fattr, - .label = olabel, .server = server, }; struct nfs4_exception exception = { @@ -3373,7 +3370,7 @@ static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, adjust_flags |= NFS_INO_INVALID_OTHER; do { - nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, olabel), + nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, fattr->label), inode, adjust_flags); err = _nfs4_do_setattr(inode, &arg, &res, cred, ctx); @@ -4233,7 +4230,6 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, struct inode *inode = d_inode(dentry); const struct cred *cred = NULL; struct nfs_open_context *ctx = NULL; - struct nfs4_label *label = NULL; int status; if (pnfs_ld_layoutret_on_setattr(inode) && @@ -4259,20 +4255,15 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, cred = ctx->cred; } - label = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); - if (IS_ERR(label)) - return PTR_ERR(label); - /* Return any delegations if we're going to change ACLs */ if ((sattr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) nfs4_inode_make_writeable(inode); - status = nfs4_do_setattr(inode, cred, fattr, sattr, ctx, NULL, label); + status = nfs4_do_setattr(inode, cred, fattr, sattr, ctx, NULL); if (status == 0) { nfs_setattr_update_inode(inode, sattr, fattr); - nfs_setsecurity(inode, fattr, label); + nfs_setsecurity(inode, fattr, fattr->label); } - nfs4_label_free(label); return status; } @@ -6024,8 +6015,7 @@ static int nfs4_get_security_label(struct inode *inode, void *buf, static int _nfs4_do_set_security_label(struct inode *inode, struct nfs4_label *ilabel, - struct nfs_fattr *fattr, - struct nfs4_label *olabel) + struct nfs_fattr *fattr) { struct iattr sattr = {0}; @@ -6040,7 +6030,6 @@ static int _nfs4_do_set_security_label(struct inode *inode, }; struct nfs_setattrres res = { .fattr = fattr, - .label = olabel, .server = server, }; struct rpc_message msg = { @@ -6061,15 +6050,13 @@ static int _nfs4_do_set_security_label(struct inode *inode, static int nfs4_do_set_security_label(struct inode *inode, struct nfs4_label *ilabel, - struct nfs_fattr *fattr, - struct nfs4_label *olabel) + struct nfs_fattr *fattr) { struct nfs4_exception exception = { }; int err; do { - err = _nfs4_do_set_security_label(inode, ilabel, - fattr, olabel); + err = _nfs4_do_set_security_label(inode, ilabel, fattr); trace_nfs4_set_security_label(inode, err); err = nfs4_handle_exception(NFS_SERVER(inode), err, &exception); @@ -6080,32 +6067,21 @@ static int nfs4_do_set_security_label(struct inode *inode, static int nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen) { - struct nfs4_label ilabel, *olabel = NULL; - struct nfs_fattr fattr; + struct nfs4_label ilabel = {0, 0, buflen, (char *)buf }; + struct nfs_fattr *fattr; int status; if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) return -EOPNOTSUPP; - nfs_fattr_init(&fattr); + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); + if (fattr == NULL) + return -ENOMEM; - ilabel.pi = 0; - ilabel.lfs = 0; - ilabel.label = (char *)buf; - ilabel.len = buflen; - - olabel = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); - if (IS_ERR(olabel)) { - status = -PTR_ERR(olabel); - goto out; - } - - status = nfs4_do_set_security_label(inode, &ilabel, &fattr, olabel); + status = nfs4_do_set_security_label(inode, &ilabel, fattr); if (status == 0) - nfs_setsecurity(inode, &fattr, olabel); + nfs_setsecurity(inode, fattr, fattr->label); - nfs4_label_free(olabel); -out: return status; } #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index b002a39d39ea..5c7d37633cc8 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -6616,7 +6616,7 @@ static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, status = decode_setattr(xdr); if (status) goto out; - decode_getfattr_label(xdr, res->fattr, res->label, res->server); + decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); out: return status; } diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 817f1bf5f187..967a0098f0a9 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -832,7 +832,6 @@ struct nfs_getaclres { struct nfs_setattrres { struct nfs4_sequence_res seq_res; struct nfs_fattr * fattr; - struct nfs4_label *label; const struct nfs_server * server; }; From patchwork Fri Oct 22 17:11:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CE86C433FE for ; Fri, 22 Oct 2021 17:11:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15BCB611F2 for ; Fri, 22 Oct 2021 17:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233863AbhJVRNz (ORCPT ); Fri, 22 Oct 2021 13:13:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233972AbhJVRNj (ORCPT ); Fri, 22 Oct 2021 13:13:39 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C4D1C061764 for ; Fri, 22 Oct 2021 10:11:21 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id o20so2839344qvk.7 for ; Fri, 22 Oct 2021 10:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z9byFL9ZYKIXoEzX0bX5NspITpcO7hh4c701ZZ04+cg=; b=qegxFXY7H9HZLOUN35P1PKZFKGO9qhwMiRh1VDxtSWuiFH7PFcCbznxoPYZG/AFmpk CQ+IPnVyYhDkg8tjLs5QjLVR4CR9a/E/O+BOB30iMo1mQFunCbf+HpRnbtc5Ut9J6kin QokoDWAo5G08X0NMtc5cfjmoaAzwA06hL4aC7Y71L8N62kH6aTbJ+pS7EU2uujfOThmD 8g8xFs9WidJzXIEsP4Ey8ySdGU0Nle5zxg7+VcIKtXYbtQXoHci6xFCEJYkm7XDS2ude nmoiEa5KoElmy5zjxIr+OBTd1LTgUs3RUqfJ1zoTiA/2fHRZSqBnYSTy1ZOiy7FguzlM H57A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=z9byFL9ZYKIXoEzX0bX5NspITpcO7hh4c701ZZ04+cg=; b=fTpDNBtaE0iXJ4g5iRmsS54ENehj73RnT7Tdnc6gdvVG4OnL5cITByK6wcmjoDrdPa Qn74Ba6xEhjWiNu8QUl8PVMu/cJu2MWlqQ62A4w8o0O8gKeQAJSF3ud6zSVlJRnN/djx eW6nqDlWqhBXpuQPGRvNDziUxHSkij4ytVRYDT1lsjo1T2emTTdIYrA3+cHYudV6ADgw zwl8a2zn8JgJJ7bVmuttvnkVLucaTTO8Rh9nRiqu3gzr8/htxxTdti0t4hHzmt2fUVwL vnr8FYJMNW7lI5AGIDcHAIMdiFCL4CsokGCVxScZL9r7JrBBRR2pOArPcSOaysSr2Zw9 SoWA== X-Gm-Message-State: AOAM53200/rL3f4lXGkdPt/ssUO7RQsx2CXrFYLfomD2voxeMQmbvRhF 9h7PEAVYt9zO4VvhA4si8n0= X-Google-Smtp-Source: ABdhPJyFdeYaeODvL88Nv5P75xeM9A7WYpIMrOyxmOpPLK8t9/Q/F7ZrQQdVq+GD/9SIAi65xuR3qg== X-Received: by 2002:a0c:e64e:: with SMTP id c14mr842570qvn.56.1634922680673; Fri, 22 Oct 2021 10:11:20 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:20 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 10/14] NFS: Remove the nfs4_label argument from nfs_instantiate() Date: Fri, 22 Oct 2021 13:11:09 -0400 Message-Id: <20211022171113.16739-11-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Pull the label from the fattr instead. Signed-off-by: Anna Schumaker --- fs/nfs/dir.c | 5 ++--- fs/nfs/nfs4proc.c | 2 +- fs/nfs/proc.c | 8 ++++---- include/linux/nfs_fs.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 7692d932add9..77bcafc692c3 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2073,12 +2073,11 @@ EXPORT_SYMBOL_GPL(nfs_add_or_obtain); * Code common to create, mkdir, and mknod. */ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, - struct nfs4_label *label) + struct nfs_fattr *fattr) { struct dentry *d; - d = nfs_add_or_obtain(dentry, fhandle, fattr, label); + d = nfs_add_or_obtain(dentry, fhandle, fattr, fattr->label); if (IS_ERR(d)) return PTR_ERR(d); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index a3b204f2f85c..b36cea00977d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4860,7 +4860,7 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_ data->res.fattr->time_start, NFS_INO_INVALID_DATA); spin_unlock(&dir->i_lock); - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.fattr->label); + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); } return status; } diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index d941cd0fe34d..3d494057dbfc 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -255,7 +255,7 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); nfs_mark_for_revalidate(dir); if (status == 0) - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, NULL); + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); nfs_free_createdata(data); out: dprintk("NFS reply create: %d\n", status); @@ -302,7 +302,7 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); } if (status == 0) - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, NULL); + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); nfs_free_createdata(data); out: dprintk("NFS reply mknod: %d\n", status); @@ -434,7 +434,7 @@ nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, * should fill in the data with a LOOKUP call on the wire. */ if (status == 0) - status = nfs_instantiate(dentry, fh, fattr, NULL); + status = nfs_instantiate(dentry, fh, fattr); out_free: nfs_free_fattr(fattr); @@ -463,7 +463,7 @@ nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); nfs_mark_for_revalidate(dir); if (status == 0) - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, NULL); + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); nfs_free_createdata(data); out: dprintk("NFS reply mkdir: %d\n", status); diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 56ba52ec2228..052f9c367d17 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -527,7 +527,7 @@ extern struct dentry *nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr, struct nfs4_label *label); extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, - struct nfs_fattr *fattr, struct nfs4_label *label); + struct nfs_fattr *fattr); extern int nfs_may_open(struct inode *inode, const struct cred *cred, int openflags); extern void nfs_access_zap_cache(struct inode *inode); extern int nfs_access_get_cached(struct inode *inode, const struct cred *cred, struct nfs_access_entry *res, From patchwork Fri Oct 22 17:11:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90B99C433EF for ; Fri, 22 Oct 2021 17:11:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7FA55611F2 for ; Fri, 22 Oct 2021 17:11:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233908AbhJVRNx (ORCPT ); Fri, 22 Oct 2021 13:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233978AbhJVRNj (ORCPT ); Fri, 22 Oct 2021 13:13:39 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A140C061764 for ; Fri, 22 Oct 2021 10:11:22 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id g14so2873804qvb.0 for ; Fri, 22 Oct 2021 10:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YuzYjtQAFGzwVEdsHhO++OF84ogE/XJ6iYl+L5z2zMM=; b=audN897xzvqHGjBgJ3SmTH3Sobw0o2LrWBnb0IAvipAeDw8Anwh2JfoCuBDs6Zgflj aR/3USDWg4ZCxZaE7o14ILDoMVWyrIpd5YiUV6c45B4Eu5frT/iqjllJp/Yvq5dKyJbM We3Sl56+aJ12VnTEhL/C4/6gG1PFluN5OW7pN0TsJzk9cp2uExEk9abQxMG2cKY5vo5k Z06fbSi1TpBUwui4dTMFDT114bscpuXUix44ryGxnQoC23+FuOQXrAZPiS82qpp8Wabt AhjCwwvvYC204Q8I61WI7JiMfDkF2R3ZKYA+9CDRnD9LXfAUp1RyBM9/7D3zgaYhDicD RVUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=YuzYjtQAFGzwVEdsHhO++OF84ogE/XJ6iYl+L5z2zMM=; b=GKopcPJA3q/+lBI/VWQESjjAZDf5GIWhFk5OXOwGeu9EA5dNQfTl9GeTBRXJsT58dr gUutzZrwhzmc5TkcKdWFErXS5cffryJ4lu6BrIPd7b54ncG2IxO/bo86b8gLAxIRRkUe n0P7AWU2Dpoo++Yead7En0tY80wINPImmcu0gtrmTgE2/ZNKr+e1FXvncfy1zrz22y3s ZaXXwwugSkshhsM+4+rX6nH4Fvkybuqs+GETQoTMleUj6DrPqK21bNJXqPf608IoQYbc 1junxZdx3RpWI38S7jPajKfoq4nbYpSu1og4mrAX9ns6N3SnjlDt8eYlBDI2PJavuuBp qUQg== X-Gm-Message-State: AOAM533aoe2FWmehCXFh5RRTljD2iPbfprXASN0SGl4F5igA4ikq9LXc pOwfqtB2TZvwrKLglzGksXA= X-Google-Smtp-Source: ABdhPJyelD35nLAIhydg4yVDSJE88/uKtgRQ2TLPJ2rbR6hWo8ODQGvg5/S7xiY+7l26anREvqRMuA== X-Received: by 2002:a05:6214:c2f:: with SMTP id a15mr1305538qvd.14.1634922681279; Fri, 22 Oct 2021 10:11:21 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:21 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 11/14] NFS: Remove the nfs4_label argument from nfs_add_or_obtain() Date: Fri, 22 Oct 2021 13:11:10 -0400 Message-Id: <20211022171113.16739-12-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Signed-off-by: Anna Schumaker --- fs/nfs/dir.c | 7 +++---- fs/nfs/nfs3proc.c | 2 +- include/linux/nfs_fs.h | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 77bcafc692c3..cf7d0280155a 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2034,8 +2034,7 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) struct dentry * nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, - struct nfs4_label *label) + struct nfs_fattr *fattr) { struct dentry *parent = dget_parent(dentry); struct inode *dir = d_inode(parent); @@ -2058,7 +2057,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle, if (error < 0) goto out_error; } - inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label); + inode = nfs_fhget(dentry->d_sb, fhandle, fattr, fattr->label); d = d_splice_alias(inode, dentry); out: dput(parent); @@ -2077,7 +2076,7 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, { struct dentry *d; - d = nfs_add_or_obtain(dentry, fhandle, fattr, fattr->label); + d = nfs_add_or_obtain(dentry, fhandle, fattr); if (IS_ERR(d)) return PTR_ERR(d); diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 7bae21a2ba05..7100514d306b 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c @@ -321,7 +321,7 @@ nfs3_do_create(struct inode *dir, struct dentry *dentry, struct nfs3_createdata if (status != 0) return ERR_PTR(status); - return nfs_add_or_obtain(dentry, data->res.fh, data->res.fattr, NULL); + return nfs_add_or_obtain(dentry, data->res.fh, data->res.fattr); } static void nfs3_free_createdata(struct nfs3_createdata *data) diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 052f9c367d17..4566c2692cdd 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -524,8 +524,7 @@ extern void nfs_set_verifier(struct dentry * dentry, unsigned long verf); extern void nfs_clear_verifier_delegated(struct inode *inode); #endif /* IS_ENABLED(CONFIG_NFS_V4) */ extern struct dentry *nfs_add_or_obtain(struct dentry *dentry, - struct nfs_fh *fh, struct nfs_fattr *fattr, - struct nfs4_label *label); + struct nfs_fh *fh, struct nfs_fattr *fattr); extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); extern int nfs_may_open(struct inode *inode, const struct cred *cred, int openflags); From patchwork Fri Oct 22 17:11:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578233 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E24A5C4332F for ; Fri, 22 Oct 2021 17:11:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3D85611CB for ; Fri, 22 Oct 2021 17:11:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233715AbhJVRN7 (ORCPT ); Fri, 22 Oct 2021 13:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233524AbhJVRNn (ORCPT ); Fri, 22 Oct 2021 13:13:43 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB8FC061766 for ; Fri, 22 Oct 2021 10:11:25 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id b1so919283qvk.5 for ; Fri, 22 Oct 2021 10:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SHDA7YvQRnodq68TQ5EaK5vBfZ9KMV2Z6ZTLczSeX2c=; b=IDi6UhiNhuleYpZPW9W9mKRNOMBDxNHvqIDZ9BWqsZvV96+ftlsk7LZkTJXsxlju3D 2bbDMEdbcj7JondLCAcMeLEeGegBgYKKJejE6QOcY0PG1CR+YAe+1yfNps9k0n4ijHHO bIXutq9E2pYbpSlzCWevjCjbMQJZhmhszG48sMhySJU4ITUGx/wMu6cZzcb17EBzJbGD wfNHQy+TeFLhuK1idlwjoiHWJOO8aSY54JCJLDiTTH5/BimjFYiZxZKM5Sk3s1wRf8Jx RNPWmZvJoym3pwaho5JExgzqljuJ1Wgq2ttZJB+dwq9sj/r7UIX3QuPV2JzZI2VRoANe VZcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=SHDA7YvQRnodq68TQ5EaK5vBfZ9KMV2Z6ZTLczSeX2c=; b=O/iQojFZ/A1StiJJHoyDBa/gL2DN6RX6cM+eLGx4AmYtiAL2Y9bpLjn+EX54cIxDW7 T8RrYtVAY2EqBiZ4RXbOQLxrI9XSjLVgGUmUT9GW/4MiKJ00Sf0Ss8V3GPid/TRSwFNb j/LevdCQfApcilXvv5At+jfesY62oVPQaKOr4Y8YMXD/pLFuDcHGOroCSlyHRfqQhY9i 4gASvykBFc60HZG7v9k5SITWDUr1fi3vVck0ZPAmrv3zALdKcbLMPJKyoRkvlYOzJMK3 G37qbOKWzRrfFnMRXlXkZk/KBWHdMHFnhfc/88aSQ5QeVTMo0me5ABMPVqS1JoKTs3UX R8/A== X-Gm-Message-State: AOAM533gBO9H3kC0CpAulayX7kdgF0tAPKbTZTBWQ0kpnIgwN1+u0dWm /FyZODsqfNAB7bq9tWjN+z8= X-Google-Smtp-Source: ABdhPJxvqQ9it74AsJqzNqfEcL3th4lHgXALo9y6neNVs4iHVMtKvEAy/c+viN1pRYEzjuGgM/nfjw== X-Received: by 2002:a0c:ea2a:: with SMTP id t10mr1216972qvp.35.1634922681940; Fri, 22 Oct 2021 10:11:21 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:21 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 12/14] NFS: Remove the nfs4_label argument from nfs_fhget() Date: Fri, 22 Oct 2021 13:11:11 -0400 Message-Id: <20211022171113.16739-13-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Signed-off-by: Anna Schumaker --- fs/nfs/dir.c | 6 +++--- fs/nfs/export.c | 4 ++-- fs/nfs/getroot.c | 2 +- fs/nfs/inode.c | 4 ++-- fs/nfs/nfs4file.c | 3 +-- fs/nfs/nfs4proc.c | 2 +- include/linux/nfs_fs.h | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index cf7d0280155a..a34cbdd2b632 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -695,7 +695,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry, goto out; } - inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr, entry->fattr->label); + inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr); alias = d_splice_alias(inode, dentry); d_lookup_done(dentry); if (alias) { @@ -1780,7 +1780,7 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in res = ERR_PTR(error); goto out; } - inode = nfs_fhget(dentry->d_sb, fhandle, fattr, fattr->label); + inode = nfs_fhget(dentry->d_sb, fhandle, fattr); res = ERR_CAST(inode); if (IS_ERR(res)) goto out; @@ -2057,7 +2057,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle, if (error < 0) goto out_error; } - inode = nfs_fhget(dentry->d_sb, fhandle, fattr, fattr->label); + inode = nfs_fhget(dentry->d_sb, fhandle, fattr); d = d_splice_alias(inode, dentry); out: dput(parent); diff --git a/fs/nfs/export.c b/fs/nfs/export.c index a0462f7e7e35..171c424cb6d5 100644 --- a/fs/nfs/export.c +++ b/fs/nfs/export.c @@ -103,7 +103,7 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid, goto out_free_fattr; } - inode = nfs_fhget(sb, server_fh, fattr, fattr->label); + inode = nfs_fhget(sb, server_fh, fattr); out_found: dentry = d_obtain_alias(inode); @@ -138,7 +138,7 @@ nfs_get_parent(struct dentry *dentry) goto out; } - pinode = nfs_fhget(sb, &fh, fattr, fattr->label); + pinode = nfs_fhget(sb, &fh, fattr); parent = d_obtain_alias(pinode); out: nfs_free_fattr(fattr); diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 7604cb6a0ac2..0aedee201166 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -91,7 +91,7 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) goto out_fattr; } - inode = nfs_fhget(s, ctx->mntfh, fsinfo.fattr, NULL); + inode = nfs_fhget(s, ctx->mntfh, fsinfo.fattr); if (IS_ERR(inode)) { dprintk("nfs_get_root: get root inode failed\n"); error = PTR_ERR(inode); diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 99ee138a0a5e..4b20ce19c90e 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -431,7 +431,7 @@ nfs_ilookup(struct super_block *sb, struct nfs_fattr *fattr, struct nfs_fh *fh) * instead of inode number. */ struct inode * -nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, struct nfs4_label *label) +nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) { struct nfs_find_desc desc = { .fh = fh, @@ -563,7 +563,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st fattr->size != 0) nfs_set_cache_invalid(inode, NFS_INO_INVALID_BLOCKS); - nfs_setsecurity(inode, fattr, label); + nfs_setsecurity(inode, fattr, fattr->label); nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); nfsi->attrtimeo_timestamp = now; diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index ef78e06bcd21..f55236169645 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -343,8 +343,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt, goto out; snprintf(read_name, len, SSC_READ_NAME_BODY, read_name_gen++); - r_ino = nfs_fhget(ss_mnt->mnt_root->d_inode->i_sb, src_fh, &fattr, - NULL); + r_ino = nfs_fhget(ss_mnt->mnt_root->d_inode->i_sb, src_fh, &fattr); if (IS_ERR(r_ino)) { res = ERR_CAST(r_ino); goto out_free_name; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b36cea00977d..975177959e07 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2012,7 +2012,7 @@ nfs4_opendata_get_inode(struct nfs4_opendata *data) if (!(data->f_attr.valid & NFS_ATTR_FATTR)) return ERR_PTR(-EAGAIN); inode = nfs_fhget(data->dir->d_sb, &data->o_res.fh, - &data->f_attr, data->f_attr.label); + &data->f_attr); break; default: inode = d_inode(data->dentry); diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 4566c2692cdd..ac4416ebf0ec 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -383,7 +383,7 @@ extern void nfs_zap_caches(struct inode *); extern void nfs_set_inode_stale(struct inode *inode); extern void nfs_invalidate_atime(struct inode *); extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, - struct nfs_fattr *, struct nfs4_label *); + struct nfs_fattr *); struct inode *nfs_ilookup(struct super_block *sb, struct nfs_fattr *, struct nfs_fh *); extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); From patchwork Fri Oct 22 17:11:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578231 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0427C433EF for ; Fri, 22 Oct 2021 17:11:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CB71611CB for ; Fri, 22 Oct 2021 17:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233803AbhJVRN5 (ORCPT ); Fri, 22 Oct 2021 13:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233985AbhJVRNl (ORCPT ); Fri, 22 Oct 2021 13:13:41 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D8CFC061764 for ; Fri, 22 Oct 2021 10:11:23 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id v10so2843627qvb.10 for ; Fri, 22 Oct 2021 10:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8ed6xmdf6+DG/JZiOm/5yoAzgmbYZVFaFoix/dDQ/0U=; b=psV2drZvQ1n17EQaOv6KWZ6rEyH7JWx+CgsnwboY4g1UAljVtDtpUOTydJkbdnTh/S f5nKfdOTdt+uZlI7bhhZtAaGk/Jkhac50r/yxv74Qb+0mX7IdvXpznxBuUhJzNLXAfRs CLzro3gZEGnrFZ9Ov2eNQxj26sBls+U+m7+1etsoXOYbu5HkCVvCJNz9IdMJHBWY57uh 8rzu6wHPaH1V26On/1yAlS1EQnvtRMwtm+vZne1SEuGXUlgvvPT8GQscs/0g/EJNvW7J m1WJRGmfiVLEgtqxCiWF+JaK75dSSAXVW6T+GzuDoPmYDzBLGVaDLZmUnqd07zr5YKij E6aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8ed6xmdf6+DG/JZiOm/5yoAzgmbYZVFaFoix/dDQ/0U=; b=eQXVkgoMsAZ4qkWEOSmC3yPX39WCHUhm8O33sMUrcZ815iMntxT78KQtBCBk7d7pQF dnQOJnitkniDIh1yUThReR0LWjZ19BtJZJziOrpIlf+xPtDdBcdvsYEl0vcomgwoqrDJ tFMMhl2DLqBI32OB+E1A+csNz8tbB1/gUtFw0sKSFuiWGZRZJV/NEaV33EZ7jByWuy1Z Hx5yQ3NcV+wtFsgGYx4cTWPry3NpcvEPmZSvzshPQI1PC2WDaKfbJ4tL/PT+B47ScfoA LglWpK9oVPtE2bECIigpJEjOhE+7/t5q3IMPganeSUwNLbTBMs1GQEoV+0sUrlw45NDt g+yQ== X-Gm-Message-State: AOAM533dzbb4dv9ulQ4d5wzAu1L2ljIDTv6DPlYayBgOSTYkfMMtYfQA f885BzMewCms38Gnkb5C32c= X-Google-Smtp-Source: ABdhPJyh4q0HfibMrOBPkbpUKJyUUx4+18U4CETGfF/R1lyUkkY+8OgoK02ggvT9JQDGYZJrDTJBEw== X-Received: by 2002:a05:6214:dab:: with SMTP id h11mr930620qvh.48.1634922682715; Fri, 22 Oct 2021 10:11:22 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:22 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 13/14] NFS: Remove the nfs4_label argument from nfs_setsecurity Date: Fri, 22 Oct 2021 13:11:12 -0400 Message-Id: <20211022171113.16739-14-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Signed-off-by: Anna Schumaker --- fs/nfs/dir.c | 5 ++--- fs/nfs/getroot.c | 2 +- fs/nfs/inode.c | 20 +++++++++----------- fs/nfs/nfs4proc.c | 9 ++++----- include/linux/nfs_fs.h | 3 +-- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index a34cbdd2b632..bb8b1f7dcbed 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -680,8 +680,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry, nfs_set_verifier(dentry, dir_verifier); status = nfs_refresh_inode(d_inode(dentry), entry->fattr); if (!status) - nfs_setsecurity(d_inode(dentry), entry->fattr, - entry->fattr->label); + nfs_setsecurity(d_inode(dentry), entry->fattr); goto out; } else { d_invalidate(dentry); @@ -1517,7 +1516,7 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, if (nfs_refresh_inode(inode, fattr) < 0) goto out; - nfs_setsecurity(inode, fattr, fattr->label); + nfs_setsecurity(inode, fattr); nfs_set_verifier(dentry, dir_verifier); /* set a readdirplus hint that we had a cache miss */ diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 0aedee201166..11ff2b2e060f 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -148,7 +148,7 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) !(kflags_out & SECURITY_LSM_NATIVE_LABELS)) server->caps &= ~NFS_CAP_SECURITY_LABEL; - nfs_setsecurity(inode, fsinfo.fattr, fsinfo.fattr->label); + nfs_setsecurity(inode, fsinfo.fattr); error = 0; out_fattr: diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 4b20ce19c90e..d109df27c8c6 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -350,23 +350,22 @@ static void nfs_clear_label_invalid(struct inode *inode) spin_unlock(&inode->i_lock); } -void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, - struct nfs4_label *label) +void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr) { int error; - if (label == NULL) + if (fattr->label == NULL) return; if ((fattr->valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL) && inode->i_security) { - error = security_inode_notifysecctx(inode, label->label, - label->len); + error = security_inode_notifysecctx(inode, fattr->label->label, + fattr->label->len); if (error) printk(KERN_ERR "%s() %s %d " "security_inode_notifysecctx() %d\n", __func__, - (char *)label->label, - label->len, error); + (char *)fattr->label->label, + fattr->label->len, error); nfs_clear_label_invalid(inode); } } @@ -397,8 +396,7 @@ struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) } EXPORT_SYMBOL_GPL(nfs4_label_alloc); #else -void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, - struct nfs4_label *label) +void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr) { } #endif @@ -563,7 +561,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) fattr->size != 0) nfs_set_cache_invalid(inode, NFS_INO_INVALID_BLOCKS); - nfs_setsecurity(inode, fattr, fattr->label); + nfs_setsecurity(inode, fattr); nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); nfsi->attrtimeo_timestamp = now; @@ -1233,7 +1231,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) if (nfsi->cache_validity & NFS_INO_INVALID_ACL) nfs_zap_acl_cache(inode); - nfs_setsecurity(inode, fattr, fattr->label); + nfs_setsecurity(inode, fattr); dfprintk(PAGECACHE, "NFS: (%s/%Lu) revalidation complete\n", inode->i_sb->s_id, diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 975177959e07..02c546f1cf5d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3179,8 +3179,7 @@ static int _nfs4_do_open(struct inode *dir, if (status == 0) { nfs_setattr_update_inode(state->inode, sattr, opendata->o_res.f_attr); - nfs_setsecurity(state->inode, opendata->o_res.f_attr, - opendata->o_res.f_attr->label); + nfs_setsecurity(state->inode, opendata->o_res.f_attr); } sattr->ia_valid = ia_old; } @@ -4262,7 +4261,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, status = nfs4_do_setattr(inode, cred, fattr, sattr, ctx, NULL); if (status == 0) { nfs_setattr_update_inode(inode, sattr, fattr); - nfs_setsecurity(inode, fattr, fattr->label); + nfs_setsecurity(inode, fattr); } return status; } @@ -4783,7 +4782,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct nfs4_inc_nlink(inode); status = nfs_post_op_update_inode(inode, res.fattr); if (!status) - nfs_setsecurity(inode, res.fattr, res.fattr->label); + nfs_setsecurity(inode, res.fattr); } out: @@ -6080,7 +6079,7 @@ nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen) status = nfs4_do_set_security_label(inode, &ilabel, fattr); if (status == 0) - nfs_setsecurity(inode, fattr, fattr->label); + nfs_setsecurity(inode, fattr); return status; } diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index ac4416ebf0ec..525e2a6ef3b3 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -404,8 +404,7 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *map extern int nfs_revalidate_mapping_rcu(struct inode *inode); extern int nfs_setattr(struct user_namespace *, struct dentry *, struct iattr *); extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr, struct nfs_fattr *); -extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, - struct nfs4_label *label); +extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr); extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); extern void put_nfs_open_context(struct nfs_open_context *ctx); extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, const struct cred *cred, fmode_t mode); From patchwork Fri Oct 22 17:11:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12578235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66216C433F5 for ; Fri, 22 Oct 2021 17:11:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C50E611CB for ; Fri, 22 Oct 2021 17:11:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233802AbhJVRN5 (ORCPT ); Fri, 22 Oct 2021 13:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233987AbhJVRNl (ORCPT ); Fri, 22 Oct 2021 13:13:41 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A936C061764 for ; Fri, 22 Oct 2021 10:11:24 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id h65so5471034qke.0 for ; Fri, 22 Oct 2021 10:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D8uX/xki72nt+sXdqVs+czvAZ2u+0C0hWjF2S5EFh24=; b=cR74pEyJ3naCv7dA/xYN7bvMz/8My/FwIPrqrzlwNQxwSGG7kSQkHyoPO0CbANJ+kN 2q1c/6bmEm5l38fLZdxo24cEYLZPED5XT5y0PJqMl9bKUMXCO/sWPuU2jBYlSMY0iytw tZZYeucKUJFOwo7y2lLRCYnQluZmhE4EcqRw9F+TZc14aDNu2HXxeqtBBe8qcQp6CUBL ZZPWRVUVYeoa8TRsv14P9CzgHveldGTj+y1cFBXvyzjHHx5ek5WSvbztC48+vpbHoLHY MDrdfw8e/fPtFlm7jybPlxiRES6JzuKNiA+OKyuKNLji3MP9dkP7F91ceeCW/AsL2jSj X/BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=D8uX/xki72nt+sXdqVs+czvAZ2u+0C0hWjF2S5EFh24=; b=74+LFE3u6TZ9XuN8oi6Gdl4UY39j5Tz6R0OVFwAaFM082b+cInyb7z8GSp15wnS3EA Ojfb26s71BQY/ZOPsCKWRLMJT5Sy+GKPL0FmCZF51v9v7cvUFpnD3JY02o+HPdPHHJ3z Qj2Md2CBsfMUgLt5sdJb9xcigvUfYd3TFTHIPDPAWPNSoLOIHW4b26wCkVCB0sxPSrt9 S8YnxCeP5qZnPlajlhQZBsM7GWtrROmfJ4V0wlZetibj5yD/TwsYryedvL6PZT5dUPUm D2ilKnBZf3Ao8m63+Z7kqVqzjmvtCQNzThnUNekfFGzJiOVJgGkLJOCMeAfXPXeIAZTJ divw== X-Gm-Message-State: AOAM532EoT2Ajbq1sJBX598fb8uY079LMSmre34y/91WiD+qNFyCAOfd +z8khOBL9bZjmUpR/vnslZ4= X-Google-Smtp-Source: ABdhPJxdU/v5vSf/83JdnWk9dVSQiEX0KatXUH+kO99u9WckI5tDxJNpygUAMnh7lM1v0rycJy2YTw== X-Received: by 2002:a37:a212:: with SMTP id l18mr1149809qke.28.1634922683324; Fri, 22 Oct 2021 10:11:23 -0700 (PDT) Received: from gouda.nowheycreamery.com ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id s22sm4484586qko.135.2021.10.22.10.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 10:11:23 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v2 14/14] NFS: Remove the nfs4_label argument from decode_getattr_*() functions Date: Fri, 22 Oct 2021 13:11:13 -0400 Message-Id: <20211022171113.16739-15-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> References: <20211022171113.16739-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Wa can check if the fattr has an allocated label when needed Signed-off-by: Anna Schumaker --- fs/nfs/nfs4xdr.c | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 5c7d37633cc8..1e3b1db7afa9 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -4582,8 +4582,7 @@ static int decode_attr_mdsthreshold(struct xdr_stream *xdr, static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fattr *fattr, struct nfs_fh *fh, - struct nfs4_fs_locations *fs_loc, struct nfs4_label *label, - const struct nfs_server *server) + struct nfs4_fs_locations *fs_loc, const struct nfs_server *server) { int status; umode_t fmode = 0; @@ -4698,8 +4697,8 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, if (status < 0) goto xdr_error; - if (label) { - status = decode_attr_security_label(xdr, bitmap, label); + if (fattr->label) { + status = decode_attr_security_label(xdr, bitmap, fattr->label); if (status < 0) goto xdr_error; fattr->valid |= status; @@ -4712,7 +4711,7 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fattr, struct nfs_fh *fh, struct nfs4_fs_locations *fs_loc, - struct nfs4_label *label, const struct nfs_server *server) + const struct nfs_server *server) { unsigned int savep; uint32_t attrlen, @@ -4731,8 +4730,7 @@ static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fat if (status < 0) goto xdr_error; - status = decode_getfattr_attrs(xdr, bitmap, fattr, fh, fs_loc, - label, server); + status = decode_getfattr_attrs(xdr, bitmap, fattr, fh, fs_loc, server); if (status < 0) goto xdr_error; @@ -4742,16 +4740,10 @@ static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fat return status; } -static int decode_getfattr_label(struct xdr_stream *xdr, struct nfs_fattr *fattr, - struct nfs4_label *label, const struct nfs_server *server) -{ - return decode_getfattr_generic(xdr, fattr, NULL, NULL, label, server); -} - static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, const struct nfs_server *server) { - return decode_getfattr_generic(xdr, fattr, NULL, NULL, NULL, server); + return decode_getfattr_generic(xdr, fattr, NULL, NULL, server); } /* @@ -6179,7 +6171,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_getfh(xdr, res->fh); if (status) goto out; - status = decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); + status = decode_getfattr(xdr, res->fattr, res->server); out: return status; } @@ -6209,7 +6201,7 @@ static int nfs4_xdr_dec_lookupp(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_getfh(xdr, res->fh); if (status) goto out; - status = decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); + status = decode_getfattr(xdr, res->fattr, res->server); out: return status; } @@ -6236,8 +6228,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, goto out; status = decode_getfh(xdr, res->fh); if (status == 0) - status = decode_getfattr_label(xdr, res->fattr, - res->fattr->label, res->server); + status = decode_getfattr(xdr, res->fattr, res->server); out: return status; } @@ -6331,7 +6322,7 @@ static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_restorefh(xdr); if (status) goto out; - decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); + decode_getfattr(xdr, res->fattr, res->server); out: return status; } @@ -6361,7 +6352,7 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_getfh(xdr, res->fh); if (status) goto out; - decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); + decode_getfattr(xdr, res->fattr, res->server); out: return status; } @@ -6394,7 +6385,7 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status = decode_putfh(xdr); if (status) goto out; - status = decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); + status = decode_getfattr(xdr, res->fattr, res->server); out: return status; } @@ -6532,7 +6523,7 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr, goto out; if (res->access_request) decode_access(xdr, &res->access_supported, &res->access_result); - decode_getfattr_label(xdr, res->f_attr, res->f_attr->label, res->server); + decode_getfattr(xdr, res->f_attr, res->server); if (res->lg_res) decode_layoutget(xdr, rqstp, res->lg_res); out: @@ -6616,7 +6607,7 @@ static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, status = decode_setattr(xdr); if (status) goto out; - decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server); + decode_getfattr(xdr, res->fattr, res->server); out: return status; } @@ -7031,7 +7022,7 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, status = decode_getfattr_generic(xdr, &res->fs_locations->fattr, NULL, res->fs_locations, - NULL, res->fs_locations->server); + res->fs_locations->server); if (status) goto out; if (res->renew) @@ -7044,7 +7035,7 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, status = decode_getfattr_generic(xdr, &res->fs_locations->fattr, NULL, res->fs_locations, - NULL, res->fs_locations->server); + res->fs_locations->server); } out: return status; @@ -7475,7 +7466,7 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, return -EAGAIN; if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, - NULL, entry->fattr->label, entry->server) < 0) + NULL, entry->server) < 0) return -EAGAIN; if (entry->fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) entry->ino = entry->fattr->mounted_on_fileid;