From patchwork Thu Jul 12 18:24:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10522113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B3CF0605DC for ; Thu, 12 Jul 2018 18:25:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DBDC283D9 for ; Thu, 12 Jul 2018 18:25:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9210D29B36; Thu, 12 Jul 2018 18:25:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2533F29B30 for ; Thu, 12 Jul 2018 18:25:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726589AbeGLSgE (ORCPT ); Thu, 12 Jul 2018 14:36:04 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:39534 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726444AbeGLSgE (ORCPT ); Thu, 12 Jul 2018 14:36:04 -0400 Received: by mail-io0-f194.google.com with SMTP id e13-v6so29063706iof.6 for ; Thu, 12 Jul 2018 11:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=cXMvh6iVlq//a3uGZhl87uxFSRyJleeDdjPGYbvkAUg=; b=iOMYOqbF4XhsauE8MrwUB+bUOpcH+KZI6OjnkDZX+nVA7yzs3q1d8fu/d5lh3XhNIi qyQQOfRVkvGF0BPu4qXUoNdJfZJyRCSM2Vwverp+1E3J5burVT6f65N9OI1lv54Y4QNU MPHkkrqiE23KhreDDsi3vaCcKz+pXTfDZP1bOg5Qlvy5ztDZUDvMUY/aAY03RefYSG4I NBS5rlaHL8BGFHA9PUQa9Rsr2rg0YaqdkXEDC4ANJ51JCOPiW/QGAcR7jr08o1A43Fgu lMToAaIOE2dd8q8ZFLR1VZTO2riO9oYODNJVE+u20WNJKf+Yy4rkRRIqGJKlq1ABYsPs MkYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cXMvh6iVlq//a3uGZhl87uxFSRyJleeDdjPGYbvkAUg=; b=P7JE7l1PWtpnQoW8S6BUivQiiUti+8DuipGQb6kLnAufndXQh2GlIr41nM99FSNYJe rq5F6tvjAPTFAO7bZPPjWsisfb2QsDClVxiAA98h3rEQw/uhi2RaTinqjYvxmFZLqbOL vTt8Y8tW/gbx1k4ttCLsTm0m8otNQo+p0E0j5ot6R6aqceO3MRW3ZBaRTbqly1ff/IuJ /PpCz3J8TSTs54AUy9koFNuSRqRYuwPoiL3qVs7fGkIc9Ok4rgLSO57KF+NmOvlHZK81 8VWKCA7jWh9iAxu43bMcQIaN1TYuG8l0xivx5wtigkO1NI+E8i7VLyqacoIBYeaMeO8t ON5A== X-Gm-Message-State: APt69E23oJsqKJfJqSFxFv+MSr4nMnDxr8zHlSm8GoCiMbcx6E4a5Gnb pvoSD+GUFcWgeeMgcdVb4GVdiYg= X-Google-Smtp-Source: AAOMgpfbhpjl2E3eUtbCHqAEXjY/vvctGpNq321dCEeJ996DNJs1G+28e1tov78UGB+aug3uCnTy3g== X-Received: by 2002:a6b:b496:: with SMTP id d144-v6mr27529337iof.26.1531419920352; Thu, 12 Jul 2018 11:25:20 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (c-68-40-195-73.hsd1.mi.comcast.net. [68.40.195.73]) by smtp.gmail.com with ESMTPSA id u15-v6sm9730818iog.62.2018.07.12.11.25.19 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Jul 2018 11:25:19 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH] pNFS: Parse the results of layoutget on open even if permissions checks fail Date: Thu, 12 Jul 2018 14:24:56 -0400 Message-Id: <20180712182456.8701-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180712182456.8701-1-trond.myklebust@hammerspace.com> References: <20180712182456.8701-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Even if the results of the permissions checks failed, we should parse the results of the layout on open call so that we can return the layout if required. Note that we also want to ignore the sequence counter for whether or not a layout recall occurred. If the recall pertained to our OPEN, then the callback will know, and will attempt to wait for us to finih processing anyway. Signed-off-by: Trond Myklebust --- fs/nfs/callback_proc.c | 2 -- fs/nfs/nfs4proc.c | 5 +++-- fs/nfs/pnfs.c | 4 ---- include/linux/nfs_fs_sb.h | 1 - include/linux/nfs_xdr.h | 1 - 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index efca3d6c89f2..43ba390bb653 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -331,8 +331,6 @@ static u32 initiate_bulk_draining(struct nfs_client *clp, static u32 do_callback_layoutrecall(struct nfs_client *clp, struct cb_layoutrecallargs *args) { - write_seqcount_begin(&clp->cl_callback_count); - write_seqcount_end(&clp->cl_callback_count); if (args->cbl_recall_type == RETURN_FILE) return initiate_file_draining(clp, args); return initiate_bulk_draining(clp, args); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0a95f0a76343..2da29bc1f5d9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2834,6 +2834,9 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, nfs_save_change_attribute(d_inode(opendata->dir))); } + /* Parse layoutget results before we check for access */ + pnfs_parse_lgopen(state->inode, opendata->lgp, ctx); + ret = nfs4_opendata_access(sp->so_cred, opendata, state, fmode, flags); if (ret != 0) goto out; @@ -2842,8 +2845,6 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, nfs_inode_attach_open_context(ctx); if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) nfs4_schedule_stateid_recovery(server, state); - else - pnfs_parse_lgopen(state->inode, opendata->lgp, ctx); } out: diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 030c39c107c2..7fdac8b504dd 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1018,7 +1018,6 @@ pnfs_alloc_init_layoutget_args(struct inode *ino, nfs4_stateid_copy(&lgp->args.stateid, stateid); lgp->gfp_flags = gfp_flags; lgp->cred = get_rpccred(ctx->cred); - lgp->callback_count = raw_seqcount_begin(&server->nfs_client->cl_callback_count); return lgp; } @@ -2181,9 +2180,6 @@ void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp, } else lo = NFS_I(lgp->args.inode)->layout; - if (read_seqcount_retry(&srv->nfs_client->cl_callback_count, - lgp->callback_count)) - return; lseg = pnfs_layout_process(lgp); if (!IS_ERR(lseg)) { iomode = lgp->args.range.iomode; diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 74ae3e1d19a0..2c18d618604e 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -28,7 +28,6 @@ struct nfs41_impl_id; struct nfs_client { refcount_t cl_count; atomic_t cl_mds_count; - seqcount_t cl_callback_count; int cl_cons_state; /* current construction state (-ve: init error) */ #define NFS_CS_READY 0 /* ready to be used */ #define NFS_CS_INITING 1 /* busy initialising */ diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 712eed156d09..3b7325cfb291 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -271,7 +271,6 @@ struct nfs4_layoutget { struct nfs4_layoutget_args args; struct nfs4_layoutget_res res; struct rpc_cred *cred; - unsigned callback_count; gfp_t gfp_flags; };