Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1410645pxb; Fri, 27 Aug 2021 08:17:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4MeJ6/sh3b71yjsBud+hqdG3UwCPW8YHvl4YcxI+LMw5uegT9IqVUJ5kJ1UgBeHOKoqPb X-Received: by 2002:a05:6638:d0a:: with SMTP id q10mr8482502jaj.88.1630077425517; Fri, 27 Aug 2021 08:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630077425; cv=none; d=google.com; s=arc-20160816; b=JMvjIeJeDN+tzWGm37TylGve8cUZrP4eMpDya1Z66K925ZyOqYsyvujbqX5nBD/yeW O05wB0gqzPEofq/f6KsxLsdQAI67CsQYi+Yn5V7hz2pm8FFQYLMWPf3C8tb9ExldtF4A 8gXYWWKPDdUtTPOP6UsMfq7RFHSTgtHZTKoRACpqQ8NANC2Mz5wfuoRdVMPtIoJp2dbm ToOvHChMxqTCDiOyJLvoiHZqFLVO2tV7W69o86sifDDRlEBN7UZPJzAJFvlwU2gyw613 lfl5iWE97pCp6k5Wb2IL76mvwcoBm/dcHNCixndjpUDqh/yI8i9YpfMGemY8QnIzxIpC VHUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=FEPYq2YQQ7qamK63M1DtkerzJe9J89Sr2fXzN9aVCKU=; b=m59ok4QMJf74DhHb+Vabm9Pc2GWQ7IyjCcv/4CBXqETAGHOdu75oqbe/ygIVZ/hVee qb2HZ02ekZ+kBPzY6RQNoudK+xPkPjyc8ijE1LGmd/GnnNBOp+Tvb6n8TZkKBlh0imf7 SDqs9mRS/Me6XFEO8XL2On86c8aSQ+xDK7tGXCP67G6W1+79PiyDKhCF9tayQ/ufxyo7 gy+6gq7ONCww46JFnjCGCn5mORgPiGan/+IDTF225p0IHe/iid5ZcGNEyp42VHZuEXnV 3oh4kwGnoTh8ehoaIG63b+b2/BHE/sVc1HcoeL7Xt8UC2t00MOuThiNvfJFj5AVDrR6W /lQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si5910516jap.100.2021.08.27.08.16.49; Fri, 27 Aug 2021 08:17:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245383AbhH0PRg (ORCPT + 99 others); Fri, 27 Aug 2021 11:17:36 -0400 Received: from verein.lst.de ([213.95.11.211]:34270 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234186AbhH0PRf (ORCPT ); Fri, 27 Aug 2021 11:17:35 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 8260267373; Fri, 27 Aug 2021 17:16:44 +0200 (CEST) Date: Fri, 27 Aug 2021 17:16:44 +0200 From: Christoph Hellwig To: NeilBrown Cc: "Darrick J. Wong" , Christoph Hellwig , David Howells , torvalds@linux-foundation.org, trond.myklebust@primarydata.com, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Don't block writes to swap-files with ETXTBSY. Message-ID: <20210827151644.GB19199@lst.de> References: <162993585927.7591.10174443410031404560@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <162993585927.7591.10174443410031404560@noble.neil.brown.name> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Thu, Aug 26, 2021 at 09:57:39AM +1000, NeilBrown wrote: > > Commit dc617f29dbe5 ("vfs: don't allow writes to swap files") > broke swap-over-NFS as it introduced an ETXTBSY error when NFS tries to > swap-out using ->direct_IO(). > > There is no sound justification for this error. File permissions are > sufficient to stop non-root users from writing to a swap file, and root > must always be cautious not to do anything dangerous. > > These checks effectively provide a mandatory write lock on swap, and > mandatory locks are not supported in Linux. > > So remove all the checks that return ETXTBSY when attempts are made to > write to swap. Swap files are not just any files and do need a mandatory write lock as they are part of the kernel VM and writing to them will mess up the kernel badly. David Howells actually has sent various patches to fix swap over NFS in the last weeks.