linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "NeilBrown" <neilb@suse.de>
To: "Jens Axboe" <axboe@kernel.dk>
Cc: "Al Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Oleg Nesterov" <oleg@redhat.com>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Jeff Layton" <jlayton@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Juri Lelli" <juri.lelli@redhat.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/2] Allow a kthread to declare that it calls task_work_run()
Date: Tue, 05 Dec 2023 08:02:53 +1100	[thread overview]
Message-ID: <170172377302.7109.11739406555273171485@noble.neil.brown.name> (raw)
In-Reply-To: <e9a1cfed-42e9-4174-bbb3-1a3680cf6a5c@kernel.dk>

On Mon, 04 Dec 2023, Jens Axboe wrote:
> On 12/3/23 6:36 PM, NeilBrown wrote:
> > diff --git a/fs/namespace.c b/fs/namespace.c
> > index e157efc54023..46d640b70ca9 100644
> > --- a/fs/namespace.c
> > +++ b/fs/namespace.c
> > @@ -1328,7 +1328,7 @@ static void mntput_no_expire(struct mount *mnt)
> >  
> >  	if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
> >  		struct task_struct *task = current;
> > -		if (likely(!(task->flags & PF_KTHREAD))) {
> > +		if (likely((task->flags & PF_RUNS_TASK_WORK))) {
> 
> Extraneous parens here.

Thanks - and thanks to Matthew Wilcox too.   Fixed.

> 
> > diff --git a/kernel/task_work.c b/kernel/task_work.c
> > index 95a7e1b7f1da..aec19876e121 100644
> > --- a/kernel/task_work.c
> > +++ b/kernel/task_work.c
> > @@ -183,3 +183,4 @@ void task_work_run(void)
> >  		} while (work);
> >  	}
> >  }
> > +EXPORT_SYMBOL(task_work_run);
> 
> If we're exporting this, then I think that function needs a big
> disclaimer on exactly when it is safe to call it. And it most certainly
> needs to be a _GPL export.

I've added

 * Can be used by a kernel thread but only when no locks are held and the
 * thread won't be waited for by other code that might hold locks.  It
 * can be useful in the top-level loop of a file-serving thread to ensure
 * files get closed promptly.

to the documentation comment.
It isn't clear to me what _GPL is appropriate, but maybe the rules
changed since last I looked..... are there rules?

My reasoning was that the call is effectively part of the user-space
ABI.  A user-space process can call this trivially by invoking any
system call.  The user-space ABI is explicitly a boundary which the GPL
does not cross.  So it doesn't seem appropriate to prevent non-GPL
kernel code from doing something that non-GPL user-space code can
trivially do.

But if there are other strong opinions, or clearly documented rules that
contradict my opinion, I have not problem with adding _GPL.

Thanks,
NeilBrown


> 
> -- 
> Jens Axboe
> 
> 


  reply	other threads:[~2023-12-04 21:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04  1:36 [PATCH 0/2 v2] Move all file-close work for nfsd into nfsd threads NeilBrown
2023-12-04  1:36 ` [PATCH 1/2] Allow a kthread to declare that it calls task_work_run() NeilBrown
2023-12-04  2:13   ` Jens Axboe
2023-12-04 21:02     ` NeilBrown [this message]
2023-12-04 22:09       ` Jens Axboe
2023-12-04 22:27         ` NeilBrown
2023-12-05 11:14         ` Christian Brauner
2023-12-05 14:06           ` Jeff Layton
2023-12-05 21:28           ` NeilBrown
2023-12-05 21:58             ` Jens Axboe
2023-12-05 22:03               ` Jens Axboe
2023-12-05 22:16                 ` NeilBrown
2023-12-05 23:23                   ` NeilBrown
2023-12-05 23:31                     ` Jens Axboe
2023-12-06 14:24                       ` Christian Brauner
2023-12-08  1:40                         ` NeilBrown
2023-12-06 14:29             ` Christian Brauner
2023-12-06  5:44           ` Christoph Hellwig
2023-12-04  2:25   ` Matthew Wilcox
2023-12-04 21:04     ` NeilBrown
2023-12-04  2:40   ` Al Viro
2023-12-04 16:12     ` Oleg Nesterov
2023-12-04 21:20     ` NeilBrown
2023-12-05  6:27       ` Dave Chinner
2023-12-05  6:41   ` Dave Chinner
2023-12-05  8:48     ` NeilBrown
2023-12-05 11:29       ` Christian Brauner
2023-12-05 11:25   ` Christian Brauner
2023-12-05 14:23     ` Chuck Lever
2023-12-04  1:36 ` [PATCH 2/2] nfsd: Don't leave work of closing files to a work queue NeilBrown
2023-12-04 16:58   ` Chuck Lever
2023-12-04 22:21     ` NeilBrown
2023-12-04 23:48       ` Chuck Lever
2023-12-05  6:36   ` kernel test robot

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=170172377302.7109.11739406555273171485@noble.neil.brown.name \
    --to=neilb@suse.de \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).