All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [heads-up] mknod() broken on nfs4
Date: Thu, 23 Jun 2011 00:19:46 +0100	[thread overview]
Message-ID: <20110622231946.GH11521@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1308783620.25875.30.camel@lade.trondhjem.org>

On Wed, Jun 22, 2011 at 07:00:20PM -0400, Trond Myklebust wrote:
> > Folks, how is that code supposed to work?  lookup_instantiate_filp() should
> > *not* be called by vfs_create() triggered by mknod().  And I don't see any
> > codepath in nfs_open_create() that would not step into that.  ctx == NULL
> > is the only thing that would skip it and it definitely isn't survivable
> > by nfs4_proc_create().  Moreover, we need the rpc_cred to come from somewhere
> > and nfs4_proc_create() needs to get it from us.
> 
> I agree that we should error out gracefully instead of blowing up, but I
> fail to see why we want to support mknod for a regular file: it's not a
> posix interface, nor is it substantially different from open(O_CREAT|
> O_EXCL|O_NOFOLLOW). What is it's purpose?

It always worked that way, all the way back to Unix v6 (and I'm fairly sure
to earlier than that; don't have v5 kernel source, unfortunately).  Worked
that way in Linux since 0.02/0.03/0.10, when Linus first added mknod(2)
(presumably 0.01 had been tested with /dev populated by Minix ;-)

As for POSIX, what it says is
     The only portable use of mknod() is to create a FIFO-special file.         
     If mode is not S_IFIFO or dev is not 0, the behaviour of mknod() is        
     unspecified.                                                               
and we support it for all non-directories.  Always had...

	Note that the right thing to do is to issue CLOSE and _not_ call
lookup_instantiate_filp() if we are called from sys_mknodat().  We don't
want to leak stateid...

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
To: Trond Myklebust
	<Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [heads-up] mknod() broken on nfs4
Date: Thu, 23 Jun 2011 00:19:46 +0100	[thread overview]
Message-ID: <20110622231946.GH11521@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1308783620.25875.30.camel-SyLVLa/KEI9HwK5hSS5vWB2eb7JE58TQ@public.gmane.org>

On Wed, Jun 22, 2011 at 07:00:20PM -0400, Trond Myklebust wrote:
> > Folks, how is that code supposed to work?  lookup_instantiate_filp() should
> > *not* be called by vfs_create() triggered by mknod().  And I don't see any
> > codepath in nfs_open_create() that would not step into that.  ctx == NULL
> > is the only thing that would skip it and it definitely isn't survivable
> > by nfs4_proc_create().  Moreover, we need the rpc_cred to come from somewhere
> > and nfs4_proc_create() needs to get it from us.
> 
> I agree that we should error out gracefully instead of blowing up, but I
> fail to see why we want to support mknod for a regular file: it's not a
> posix interface, nor is it substantially different from open(O_CREAT|
> O_EXCL|O_NOFOLLOW). What is it's purpose?

It always worked that way, all the way back to Unix v6 (and I'm fairly sure
to earlier than that; don't have v5 kernel source, unfortunately).  Worked
that way in Linux since 0.02/0.03/0.10, when Linus first added mknod(2)
(presumably 0.01 had been tested with /dev populated by Minix ;-)

As for POSIX, what it says is
     The only portable use of mknod() is to create a FIFO-special file.         
     If mode is not S_IFIFO or dev is not 0, the behaviour of mknod() is        
     unspecified.                                                               
and we support it for all non-directories.  Always had...

	Note that the right thing to do is to issue CLOSE and _not_ call
lookup_instantiate_filp() if we are called from sys_mknodat().  We don't
want to leak stateid...
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-06-22 23:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21 23:59 [heads-up] mknod() broken on nfs4 Al Viro
2011-06-22  0:23 ` Al Viro
2011-06-22 23:00   ` Trond Myklebust
2011-06-22 23:00     ` Trond Myklebust
2011-06-22 23:19     ` Al Viro [this message]
2011-06-22 23:19       ` Al Viro
2011-06-23  2:48       ` Al Viro
2011-06-23  5:37       ` Al Viro

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=20110622231946.GH11521@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.