Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11170086ybi; Thu, 25 Jul 2019 11:11:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeDCFOlYSztUhDxgF76DfVht1p8yrV7tNfNeeurjGceHFT86CdgZXDzEP0FZEoeNPvfzxx X-Received: by 2002:a63:1e16:: with SMTP id e22mr18739863pge.163.1564078287834; Thu, 25 Jul 2019 11:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564078287; cv=none; d=google.com; s=arc-20160816; b=ZPGgwRTY54yyUQXSfpfvDXlYa5LSRi+UdDl3vHIY5Xxbs1A5UzxatFZYwOuzcCifx9 Gb/cxAJ5Q7bsFLRNv5AsmopWSazqABKCod52+iM0f+4bbIilg0+f6WsP18S0TS5zs/dx Q6cjwmwyRPopEE6e+KkrAfra76IsiKOxZIs32aQwHTBAx/9unMDOw7SX3NmRiJVYozYC f5d4AVtPj99ENOvM7fY8eEMKZChNzzozo/zHFM4uuQO0sfCP3a7romt5gbxNrDHv/XWo P5ushC8EoS/fKmPYXWRCFAXskQDXDekdzJgCA8tr2xmMcU+GllFdLO40n6/vHt3xrkH/ MGww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :date:cc:to:from:subject:message-id; bh=ubL+VMPyjep1YsFCwqQoL4Bq8R4x0wFfg6zYmvlWL2o=; b=X2JYcl9HcZ32yhyOYhEuiytKAoanaiv5WrxN0dyniAIgn2wabwLk2C1S3GW83wjgVH VOooLJj/TGKUawIYpXGBCtXs6/NHJoZBUDqu1FZXmX8tCo0mtnp+1Ae2yYo9lWuEE2Up cBmQelOTv/Ts/OkxomlzYFA7u798ABpNEb1VHNK6hw/6b846i6SK8YCpl0UMYV+sz7Mt LxpZlNdgiiC7W0UZIq3oagyDs+Na5WWJqitE+P5wsbknmUzzC54fvKTBAJ3pAo9mGBX2 7yW4DU9rheBb8jLa4HnGSz9NA/nmAi6IPvQXeR+bRwzWAf0a8kYTHTCaJwGoM+1fNV13 /T4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f139si47738304pfa.2.2019.07.25.11.10.59; Thu, 25 Jul 2019 11:11:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbfGYQse (ORCPT + 99 others); Thu, 25 Jul 2019 12:48:34 -0400 Received: from mail-qk1-f177.google.com ([209.85.222.177]:33198 "EHLO mail-qk1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726390AbfGYQse (ORCPT ); Thu, 25 Jul 2019 12:48:34 -0400 Received: by mail-qk1-f177.google.com with SMTP id r6so36970101qkc.0 for ; Thu, 25 Jul 2019 09:48:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=ubL+VMPyjep1YsFCwqQoL4Bq8R4x0wFfg6zYmvlWL2o=; b=PilP1sZHlBiXkrc5HbILjc3ynkWRaqA8YK93DgsFGBHdS4notdye73p8+oR8jnB90c eTYRkDOtY7Agx0oKiIfH5e2/IJFoVePbH/vy3Co9dmtivp9On3Ge5I1g72eievAt6WF3 pT2iT/erZ6ure6Z+HL2gl70+VkGHnYP2LOChr+WBnhLF083KBVopE+2q/4AkIPbCW3v3 MkR+RoRKZIk3CBciMlbyFzlZLS/GchADjI+DBJctX5oqR7rrIb68DDeps36786B45QuK ec2O/3Io+q7cuZcHbKTCeStJCebF5KEY5BbKRkrzwF9ySFtv2gNCoee7nwX8Z43qkOCv KcHQ== X-Gm-Message-State: APjAAAVwmTUlQpw/AtoTQUHZOTMuw1FUA/U1u9UOo3fYUPr+zHBvfj+f 2XbcA6FxcOIDoNv7QT0OXfKAFxg5kPQ= X-Received: by 2002:a05:620a:1116:: with SMTP id o22mr60430063qkk.82.1564073313549; Thu, 25 Jul 2019 09:48:33 -0700 (PDT) Received: from dhcp-12-212-173.gsslab.rdu.redhat.com (nat-pool-rdu-t.redhat.com. [66.187.233.202]) by smtp.gmail.com with ESMTPSA id g2sm22385399qkf.32.2019.07.25.09.48.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 09:48:32 -0700 (PDT) Message-ID: <22770aa2024c1dab1b7eaded1eed9957963413fb.camel@redhat.com> Subject: RFC: Fixing net/sunrpc/cache.c: cache_listeners_exist() function for rogue process reading a 'channel' file From: Dave Wysochanski To: NeilBrown , Bruce Fields Cc: Linux NFS Mailing List Date: Thu, 25 Jul 2019 12:48:31 -0400 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-2.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Neil, Bruce, and others, I want to see if we can improve cache_listeners_exist() to not be fooled at all by a random process reading a 'channel' file. Prior attempts have been made and Neil your most recent commit mitigated the effects however doesn't really solve it completely: 9d69338c8c5f "sunrpc/cache: handle missing listeners better" Here are a couple approaches, based on my understanding of the interface and what any legitimate "user of the channel files" (aka daemons or userspace programs, most if not all live in nfs-utils) do in practice: 1) rather than tracking opens for read, track opens for write on the channel file (i.e. the 'readers' member in cache_detail) 2) in addition to or in place of #1, track calls to cache_poll() Basically the above would create a 'cache_daemon_exists()' function in place of the existing 'cache_listeners_exist()' and then add some further logic to it. Do you think that is a valid approach or do you see problems with it? Because this keeps coming up in one shape or form and is hard to troubleshoot when it occurs, I think we should fix this once and for all so I'm looking for feedback on approaches. I thought of going down the road of a more elaborate daemon / kernel registration but that would require carefully making sure we have backward compatibility when variants of nfs-utils and kernel are installed. I think it may be worth looking at less invasive approaches first such as the above, but am open to feedback. Thanks.