Linux NFS development
 help / color / mirror / Atom feed
From: Wang Yugui <wangyugui@e16-tech.com>
To: Christoph Hellwig <hch@lst.de>
Cc: NeilBrown <neilb@suse.de>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	David Howells <dhowells@redhat.com>,
	trond.myklebust@primarydata.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] Don't block writes to swap-files with ETXTBSY.
Date: Thu, 02 Sep 2021 12:19:15 +0800	[thread overview]
Message-ID: <20210902121914.BFAC.409509F4@e16-tech.com> (raw)
In-Reply-To: <20210827151644.GB19199@lst.de>

Hi,

# drop  torvalds@linux-foundation.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org

A Question about ETXTBSY of nfs.
# I tried google/bing, but yet no good info is found.

test case:
/ssd is a  nfs directory
kernel: 5.10.61, 5.4.106 and more

1, on Node1:
[root@T630 ~]# echo -e '#!/bin/bash\necho hello' >/ssd/a.sh
[root@T630 ~]# chmod a+x /ssd/a.sh

2, on Node2:
[root@T640 ~]# /ssd/a.sh
-bash: /ssd/a.sh: /bin/bash: bad interpreter: Text file busy
[root@T640 ~]# bash /ssd/a.sh
hello
[root@T640 ~]# /ssd/a.sh
-bash: /ssd/a.sh: /bin/bash: bad interpreter: Text file busy

Is there any way(flush, sync)  to avoid this ETXTBSY error(Text file busy)?

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2021/09/02

> 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.



      parent reply	other threads:[~2021-09-02  4:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <162993585927.7591.10174443410031404560@noble.neil.brown.name>
2021-08-27 15:16 ` [PATCH] Don't block writes to swap-files with ETXTBSY Christoph Hellwig
2021-08-27 23:10   ` NeilBrown
2021-08-28  7:10     ` Christoph Hellwig
2021-09-02  4:19   ` Wang Yugui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210902121914.BFAC.409509F4@e16-tech.com \
    --to=wangyugui@e16-tech.com \
    --cc=darrick.wong@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=trond.myklebust@primarydata.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox