Subject: Re: linux-next: build failure after merge of the nfsd tree

From: Neil Brown <[email-masked]>
Date: Thu, 23 Sep 2010 12:51:46 +1000

On Wed, 22 Sep 2010 22:33:15 -0400
"J. Bruce Fields" <[email-masked]> wrote:

> On Thu, Sep 23, 2010 at 11:34:29AM +1000, Stephen Rothwell wrote:
> > Hi Bruce,
> > 
> > After merging the nfsd tree, today's linux-next build (powerpc
> > ppc64_defconfig) failed like this:
> > 
> > ERROR: ".get_task_comm" [fs/nfsd/nfsd.ko] undefined!
> > 
> > Caused by commit c67874f942e30039442d925b03793e0a46ddcddd ("nfsd:
> > formally deprecate legacy nfsd syscall interface").
> > 
> > get_task_comm is not exported to modules.
> > 
> > I have used the version of the nfsd tree from next-20100921 for today.
> 
> Oops, thanks.
> 
> It looks like a lot of places just do a
> 
> 	printk("%s using deprecated interface ...", current->comm);
> 
> so maybe we can get away with just that?
> 
> --b.

sched.h says:

	char comm[TASK_COMM_LEN]; /* executable name excluding path
				     - access with [gs]et_task_comm (which lock
				       it with task_lock())
				     - initialized normally by setup_new_exec */

So we should lock...

But then fs/exec.c says:
void set_task_comm(struct task_struct *tsk, char *buf)
{
	task_lock(tsk);

	/*
	 * Threads may access current->comm without holding
	 * the task lock, so write the string carefully.
	 * Readers without a lock may see incomplete new
	 * names but are safe from non-terminating string reads.
	 */
     .....

So I guess we are safe to use it unlocked for informational purposes.
That first comment could do with an update, and where-ever it was that I
copied that code from can probably be simplified too.....

NeilBrown