Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1052798iob; Fri, 13 May 2022 21:13:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLiMSoiZGW51q1xnSPUkg3UWN96JWmtTMaUWnHPFOhVzCVB1Is0XQIQ2cVcHzwIrF/nmFg X-Received: by 2002:adf:e74e:0:b0:20a:e015:b575 with SMTP id c14-20020adfe74e000000b0020ae015b575mr6305134wrn.151.1652501631436; Fri, 13 May 2022 21:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652501631; cv=none; d=google.com; s=arc-20160816; b=m5UgHyi++GegsDUWtmd67ImhYefIh6hWF4QwLrDkRRlhpJe/lHKGs55Vkqv2BdYqn8 cz5MaHY9Iako/VvSWGY4P8XPgXpilezqFgxX0FKfy/hP4uzKmedhfx6y2rYIaOFf6haf ZdgIp6ValS32iuftApsRrgC43iLvARFu2fH+398nkH4KSydMpcc7cOCRYAygmlgkibyE TSkk7Ji7ivY8q3LvvYsy2bbeDEA5P4AjmbuQDnTLHjmhvLBibr89qrbCDBhb52IkxtB4 AiO2tfKD0I3NiT/kswx9cxD85lDKDphY2QkqUkrnRa7Kp52OALXf1+yO07zuZCF2bSfa ZsLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OuTmFU0l8hFaMha30QMfj9nisFU7dckr2pldX8QNnoU=; b=NySwjfUk/Q6Dq8uQCRDlOqyhi3+rmua5JIWxmIXx5hlj7GYXwZ5ddHexCc8hb9xgKO 8ijzPx2XcWUQg7i2Zm9ntttDcZUEymIhWUHmNXhscfdolJb02g9KNvZbRSJgEq7jl88i LnKgBAU+Gi++fi0XJVTivJPij1g33AzUrY2xPEIhCiLrpN5VBEe/1L74naAPhhrcXvHa ccc/pVfaER8Ec6R8xcX7oVFiDGsNFEmIOWGC8qUw/6BNX6BkRllvtUfl5r9iIBlIMbw+ pcnt1JM69xZddHlyeyruOfOMXafSfhc2YyNNkosX2eCzBXzvLmVbvXvyLbS1CO5tZrHI xv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=coOh1nMN; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y23-20020a05600c365700b00394952d9a8esi7579785wmq.30.2022.05.13.21.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:13:51 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=coOh1nMN; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 09A7031A2EC; Fri, 13 May 2022 17:44:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382933AbiEMSQp (ORCPT + 99 others); Fri, 13 May 2022 14:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378108AbiEMSQp (ORCPT ); Fri, 13 May 2022 14:16:45 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78148207920 for ; Fri, 13 May 2022 11:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652465802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuTmFU0l8hFaMha30QMfj9nisFU7dckr2pldX8QNnoU=; b=coOh1nMNNqfmlk56iQNkbTT8qRfPF5L+E0hNQXP0Oag6yU0fOTDdtRXKlEJrdO555ROs8I ZP9C849thH4hlr+M7Ul29vSVbOm5KtnR549jr2pqaH499DfwpTlD3T2LaVeUUcBKzNIJa9 b+rKVB/UOvLrD6flTuToEdOCzJSHDko= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-459-wStW75DeMICBGy8cFOLSqA-1; Fri, 13 May 2022 14:16:37 -0400 X-MC-Unique: wStW75DeMICBGy8cFOLSqA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E3FDF29AA3AF; Fri, 13 May 2022 18:16:36 +0000 (UTC) Received: from [172.16.176.1] (ovpn-64-2.rdu2.redhat.com [10.10.64.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B679140E7F12; Fri, 13 May 2022 18:16:36 +0000 (UTC) From: "Benjamin Coddington" To: "Trond Myklebust" Cc: anna@kernel.org, linux-nfs@vger.kernel.org, smayhew@redhat.com Subject: Re: [PATCH] NFSv4: Restore nfs4_label into copied nfs_fattr for referrals Date: Fri, 13 May 2022 14:16:36 -0400 Message-ID: <32BB80FC-7393-40D2-8169-BEB7CEEC55B9@redhat.com> In-Reply-To: References: <8ffe993a7aa39881d3e610d5424098ea7ec88180.1652448889.git.bcodding@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 13 May 2022, at 11:05, Trond Myklebust wrote: > On Fri, 2022-05-13 at 09:36 -0400, Benjamin Coddington wrote: >> ..which will fix up trying to free uninitialized nfs4_label: >> >> PID: 790    TASK: ffff88811b43c000  CPU: 0   COMMAND: "ls" >>  #0 [ffffc90000857920] panic at ffffffff81b9bfde >>  #1 [ffffc900008579c0] do_trap at ffffffff81023a9b >>  #2 [ffffc90000857a10] do_error_trap at ffffffff81023b78 >>  #3 [ffffc90000857a58] exc_stack_segment at ffffffff81be1f45 >>  #4 [ffffc90000857a80] asm_exc_stack_segment at ffffffff81c009de >>  #5 [ffffc90000857b08] nfs_lookup at ffffffffa0302322 [nfs] >>  #6 [ffffc90000857b70] __lookup_slow at ffffffff813a4a5f >>  #7 [ffffc90000857c60] walk_component at ffffffff813a86c4 >>  #8 [ffffc90000857cb8] path_lookupat at ffffffff813a9553 >>  #9 [ffffc90000857cf0] filename_lookup at ffffffff813ab86b >> >> Fixes: 9558a007dbc3 ("NFS: Remove the label from the nfs4_lookup_res >> struct") >> Signed-off-by: Benjamin Coddington >> --- >>  fs/nfs/nfs4proc.c | 2 ++ >>  1 file changed, 2 insertions(+) >> >> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c >> index a79f66432bd3..4566280e6ff2 100644 >> --- a/fs/nfs/nfs4proc.c >> +++ b/fs/nfs/nfs4proc.c >> @@ -4235,6 +4235,7 @@ static int nfs4_get_referral(struct rpc_clnt >> *client, struct inode *dir, >>         int status = -ENOMEM; >>         struct page *page = NULL; >>         struct nfs4_fs_locations *locations = NULL; >> +       struct nfs4_label *label = fattr->label; >>   >>         page = alloc_page(GFP_KERNEL); >>         if (page == NULL) >> @@ -4263,6 +4264,7 @@ static int nfs4_get_referral(struct rpc_clnt >> *client, struct inode *dir, >>   >>         /* replace the lookup nfs_fattr with the locations >> nfs_fattr >> */ >>         memcpy(fattr, &locations->fattr, sizeof(struct >> nfs_fattr)); >> +       fattr->label = label; >>         memset(fhandle, 0, sizeof(struct nfs_fh)); >>  out: >>         if (page) > > Thanks for finding this, but wouldn't it be better just to decode the > fattr in place instead of decoding it into locations->fattr and then > doing a memcpy() to get it placed correctly? > > i.e. add a level of indirection in struct nfs4_fs_locations so that > nfs4_xdr_dec_fs_locations() just uses our fattr instead of its own. Its a much bigger change since we'll end up needing to allocate fattr everywhere fs_locations is used after changing it to a pointer, but if that's the way you want it I'll send it along. Ben