From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C0D7C433F5 for ; Thu, 19 May 2022 18:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243498AbiESSCn (ORCPT ); Thu, 19 May 2022 14:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243526AbiESSCi (ORCPT ); Thu, 19 May 2022 14:02:38 -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 61B715A145 for ; Thu, 19 May 2022 11:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652983356; 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: in-reply-to:in-reply-to:references:references; bh=+vRbUI4/GPSCZt1VwOoZEQyVUcK9j3r3qdubIZdOiHI=; b=E9eMeyYtNG5N88qY1is+Su6/9zJWdCG8T5WokWoMybGGbEQbDwM6Xwu5DFs93C8A8BGsSd aSLknT3Hs5E/7ZUziXiquHmD08BK4EbgzwcEpAf4dXwFKgDR5J9u7mhoS+4I3cdq+0T+QL mf2tdg/4hKkxWRv75glJ6csTo7GITcM= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-RCmHFbwrMqe0nxagQYMtZQ-1; Thu, 19 May 2022 14:02:34 -0400 X-MC-Unique: RCmHFbwrMqe0nxagQYMtZQ-1 Received: by mail-ej1-f72.google.com with SMTP id ga27-20020a1709070c1b00b006f43c161da4so2926184ejc.7 for ; Thu, 19 May 2022 11:02:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+vRbUI4/GPSCZt1VwOoZEQyVUcK9j3r3qdubIZdOiHI=; b=a7b1tWsuQtvuGz48rtbojqOinlkpeWsQ+/mIzOXWYkuQB3jroqPF05KRCfUqlZ+j0R fwc9aZgAGYu8FxFt+FRAicIalzHLMNPdws8nY6ks33cFYOmSCD00P1B0J6oH4+YDCPNx bpRNOuNASA0+rPztu5cIdHhmUc/TuYze2KXLriJ/LPOZJ1HstPEVsKwMvYSVe2zfA/xS m7rtUzJafPyZh2WGoeNFLjhXbMidRj5IwQv3L9G94ptCWbmlT2PfWAhAz6n93G9tFCS8 bdp5S6Bl2n4goeukHUaE9fHBJSXogqxw3BtOl0XXtwkDFXOJ1tMngUOnv/uMp/mPKBot oLrQ== X-Gm-Message-State: AOAM533jlcWfYEy88KghsiA9kitZXpNrDYj+odBUmOwF4n/F/se94dAy j+j79fxLiUJ1SkyEpBJ2wg6xO+qxEJcxsQtEa8hrojX2DPNouISaHcRIRxqej+4OM1B8xB8wd6e P/ZWfFSUvtPHRcRwFdMHfWT/iFzdH3FROFm4vJTcv X-Received: by 2002:a05:6402:5298:b0:42a:cb63:5d10 with SMTP id en24-20020a056402529800b0042acb635d10mr6750410edb.415.1652983353659; Thu, 19 May 2022 11:02:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn6/Tj4V8KVXox3lSlmm5Gz66eQBDgYCQAVpr2miM030h/XBUwtnvlrRGYYV9HfkeB+8UEO+uov7EtDJwHTak= X-Received: by 2002:a05:6402:5298:b0:42a:cb63:5d10 with SMTP id en24-20020a056402529800b0042acb635d10mr6750403edb.415.1652983353522; Thu, 19 May 2022 11:02:33 -0700 (PDT) MIME-Version: 1.0 References: <165294669215.3283481.13374322806917745974.stgit@warthog.procyon.org.uk> In-Reply-To: <165294669215.3283481.13374322806917745974.stgit@warthog.procyon.org.uk> From: David Wysochanski Date: Thu, 19 May 2022 14:01:57 -0400 Message-ID: Subject: Re: [PATCH] nfs: Fix fscache volume key rendering for endianness To: David Howells Cc: Trond Myklebust , anna@kernel.org, Jeff Layton , linux-nfs , linux-cachefs , Linus Torvalds , linux-fsdevel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 19, 2022 at 3:51 AM David Howells wrote: > > Fix fscache volume key rendering for endianness. Convert the BE numbers in > the address to host-endian before printing them so that they're consistent > if the cache is copied between architectures. > > Question: This change could lead to misidentification of a volume directory > in the cache on a LE machine (it's unlikely because the port number as well > as the address numbers all get flipped), but it was introduced in -rc1 in > this cycle so probably isn't in any distro kernels yet. Should I add a > version number to enforce non-matching? > > Signed-off-by: David Howells > cc: Dave Wysochanski > cc: Trond Myklebust > cc: Anna Schumaker > cc: Jeff Layton > cc: linux-nfs@vger.kernel.org > cc: linux-cachefs@redhat.com > --- > > fs/nfs/fscache.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c > index f73c09a9cf0a..0e5572b192b2 100644 > --- a/fs/nfs/fscache.c > +++ b/fs/nfs/fscache.c > @@ -54,17 +54,17 @@ static bool nfs_fscache_get_client_key(struct nfs_client *clp, > > switch (clp->cl_addr.ss_family) { > case AF_INET: > - if (!nfs_append_int(key, _len, sin->sin_port) || > - !nfs_append_int(key, _len, sin->sin_addr.s_addr)) > + if (!nfs_append_int(key, _len, ntohs(sin->sin_port)) || > + !nfs_append_int(key, _len, ntohl(sin->sin_addr.s_addr))) > return false; > return true; > > case AF_INET6: > - if (!nfs_append_int(key, _len, sin6->sin6_port) || > - !nfs_append_int(key, _len, sin6->sin6_addr.s6_addr32[0]) || > - !nfs_append_int(key, _len, sin6->sin6_addr.s6_addr32[1]) || > - !nfs_append_int(key, _len, sin6->sin6_addr.s6_addr32[2]) || > - !nfs_append_int(key, _len, sin6->sin6_addr.s6_addr32[3])) > + if (!nfs_append_int(key, _len, ntohs(sin6->sin6_port)) || > + !nfs_append_int(key, _len, ntohl(sin6->sin6_addr.s6_addr32[0])) || > + !nfs_append_int(key, _len, ntohl(sin6->sin6_addr.s6_addr32[1])) || > + !nfs_append_int(key, _len, ntohl(sin6->sin6_addr.s6_addr32[2])) || > + !nfs_append_int(key, _len, ntohl(sin6->sin6_addr.s6_addr32[3]))) > return false; > return true; > > > IMO it's not worth versioning in this case but I agree with this change. Did someone report the "cache copied between architectures" issue, or is that mostly a theoretical problem you noticed? Acked-by: Dave Wysochanski