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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8308EC43214 for ; Fri, 27 Aug 2021 15:16:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3430160E90 for ; Fri, 27 Aug 2021 15:16:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3430160E90 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A60196B0071; Fri, 27 Aug 2021 11:16:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E945900002; Fri, 27 Aug 2021 11:16:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B2426B0073; Fri, 27 Aug 2021 11:16:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 6EA8A6B0071 for ; Fri, 27 Aug 2021 11:16:48 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1E2B6183B95CF for ; Fri, 27 Aug 2021 15:16:48 +0000 (UTC) X-FDA: 78521212896.05.0ACF042 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf09.hostedemail.com (Postfix) with ESMTP id 82ECC300010C for ; Fri, 27 Aug 2021 15:16:47 +0000 (UTC) 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) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=none (imf09.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de; dmarc=none X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 82ECC300010C X-Stat-Signature: o7bt83em4qfoe4gcpcj9ij8qw8muhaho X-HE-Tag: 1630077407-384994 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.