From: Ian Kent <raven@themaw.net>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Andrew Morton <akpm@osdl.org>,
nfsv4@linux-nfs.org, steved@redhat.com,
linux-kernel@vger.kernel.org, David Howells <dhowells@redhat.com>,
torvalds@osdl.org, linux-cachefs@redhat.com,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 0/7] Permit filesystem local caching and NFS superblock sharing [try #13]
Date: Tue, 05 Sep 2006 11:01:49 +0800 [thread overview]
Message-ID: <1157425309.3002.10.camel@raven.themaw.net> (raw)
In-Reply-To: <1157423027.5510.23.camel@localhost>
On Mon, 2006-09-04 at 22:23 -0400, Trond Myklebust wrote:
> On Mon, 2006-09-04 at 12:52 +0100, David Howells wrote:
> > Andrew Morton <akpm@osdl.org> wrote:
> >
> > > sony:/home/akpm> ls -l /net/bix/usr/src
> > > total 0
> > >
> > > sony:/home/akpm> showmount -e bix
> > > Export list for bix:
> > > / *
> > > /usr/src *
> > > /mnt/export *
> >
> > Yes, but what's your /etc/exports now? Not all options appear to showmount.
> >
> > Can you add "nohide" to the /usr/src and /mnt/export lines and "fsid=0" to the
> > / line if you don't currently have them and try again?
> >
> > > iirc, we decided this is related to the fs-cache infrastructure work which
> > > went into git-nfs. I think David can reproduce this?
> >
> > I'd only reproduced it with SELinux in enforcing mode.
> >
> > Under such conditions, unless there's a readdir on the root directory, the
> > subdirs under which exports exist will remain as incorrectly negative
> > dentries.
> >
> > The problem is a conjunction of circumstances:
> >
> > (1) nfs_lookup() has a shortcut in it that skips contact with the server if
> > we're doing a lookup with intent to create. This leaves an incorrectly
> > negative dentry if there _is_ actually an object on the server.
> >
> > (2) The mkdir procedure is aborted between the lookup() op and the mkdir() op
> > by SELinux (see vfs_mkdir()). Note that SELinux isn't the _only_ method
> > by which the abort can occur.
> >
> > (3) One of my patches correctly assigns the security label to the automounted
> > root dentry.
> >
> > (4) SELinux then aborts the automounter's mkdir() call because the automounter
> > does _not_ carry the correct security label to write to the NFS directory.
> >
> > (5) The incorrectly set up dentry from (1) remains because the the mkdir() op
> > is not invoked to set it right.
> >
> > The only bit I added was (3), but that's not the only circumstance in which
> > this can occur.
> >
> >
> > If, for example, I do "chmod a-w /" on the NFS server, I can see the same
> > effects on the client without the need for SELinux to put its foot in the door.
> > Automount does:
> >
> > [pid 3838] mkdir("/net", 0555) = -1 EEXIST (File exists)
> > [pid 3838] stat64("/net", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
> > [pid 3838] mkdir("/net/trash", 0555) = -1 EEXIST (File exists)
> > [pid 3838] stat64("/net/trash", {st_mode=S_IFDIR|0555, st_size=1024, ...}) = 0
> > [pid 3838] mkdir("/net/trash/mnt", 0555) = -1 EACCES (Permission denied)
> >
> > And where I was listing the disputed directory, I see:
> >
> > [root@andromeda ~]# ls -lad /net/trash/usr/src
> > drwxr-xr-x 4 root root 1024 Aug 30 10:35 /net/trash/usr/src/
> > [root@andromeda ~]#
> >
> > which isn't what I'd expect. What I'd expect is:
> >
> > [root@andromeda ~]# ls -l /net/trash/usr/src
> > total 15
> > drwxr-xr-x 3 root root 1024 Aug 30 10:35 debug/
> > -rw-r--r-- 1 root root 0 Aug 16 10:01 hello
> > drwx------ 2 root root 12288 Aug 16 10:00 lost+found/
> > [root@andromeda ~]#
>
> One way to fix this is to simply not hash the dentry when we're doing
> the O_EXCL intent optimisation, but rather to only hash it _after_ we've
> successfully created the file on the server. Something like the attached
> patch ought to do it.
>
> Note, though, that this will not fix the autofs problem: autofs is
> trying to perform a totally unnecessary mkdir(), and is giving up when
> it is told that SELinux won't authorise that particular operation. This
> is clearly an autofs bug...
selinux is not involved in this senario.
next prev parent reply other threads:[~2006-09-05 3:01 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 19:31 [PATCH 0/7] Permit filesystem local caching and NFS superblock sharing [try #13] David Howells
2006-08-30 19:31 ` [PATCH 1/7] FS-Cache: Provide a filesystem-specific sync'able page bit " David Howells
2006-08-30 19:31 ` [PATCH 2/7] FS-Cache: Generic filesystem caching facility " David Howells
2006-08-30 19:32 ` [PATCH 3/7] FS-Cache: Release page->private after failed readahead " David Howells
2006-08-30 19:32 ` [PATCH 4/7] FS-Cache: Make kAFS use FS-Cache " David Howells
2006-08-30 19:32 ` [PATCH 5/7] NFS: Use local caching " David Howells
2006-08-30 19:32 ` [PATCH 6/7] FS-Cache: CacheFiles: ia64: missing copy_page export " David Howells
2006-08-30 19:32 ` [PATCH 7/7] FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem " David Howells
2006-08-30 19:52 ` [PATCH 0/7] Permit filesystem local caching and NFS superblock sharing " Andrew Morton
2006-08-30 20:37 ` David Howells
2006-08-30 20:55 ` Andrew Morton
2006-08-31 9:58 ` David Howells
2006-08-31 17:21 ` Andrew Morton
2006-08-31 17:26 ` Trond Myklebust
2006-08-31 17:42 ` David Howells
2006-08-31 18:04 ` Andrew Morton
2006-09-01 13:08 ` David Howells
2006-09-01 16:34 ` Andrew Morton
2006-09-01 17:00 ` Trond Myklebust
2006-09-02 2:50 ` Andrew Morton
2006-09-02 4:11 ` Ian Kent
2006-09-02 5:58 ` Andrew Morton
2006-09-03 6:21 ` Ian Kent
2006-09-03 6:30 ` Andrew Morton
2006-09-03 6:43 ` Ian Kent
2006-09-03 16:58 ` Andrew Morton
2006-09-04 2:23 ` Ian Kent
2006-09-04 5:40 ` Ian Kent
2006-09-02 4:49 ` Ian Kent
2006-09-04 11:52 ` David Howells
2006-09-04 11:52 ` David Howells
2006-09-04 13:24 ` Ian Kent
2006-09-05 1:57 ` Trond Myklebust
2006-09-05 2:55 ` Ian Kent
2006-09-05 3:50 ` Trond Myklebust
2006-09-05 4:03 ` Ian Kent
2006-09-05 4:53 ` Trond Myklebust
2006-09-05 6:06 ` Ian Kent
2006-09-05 7:01 ` Ian Kent
2006-09-05 12:52 ` Trond Myklebust
2006-09-06 4:54 ` Ian Kent
2006-09-05 9:40 ` David Howells
2006-09-05 10:20 ` Ian Kent
2006-09-05 10:37 ` David Howells
2006-09-05 12:20 ` Ian Kent
2006-09-05 13:38 ` David Howells
2006-09-06 4:58 ` Ian Kent
2006-09-06 9:51 ` David Howells
2006-09-06 12:46 ` Trond Myklebust
2006-09-06 13:24 ` David Howells
2006-09-07 5:30 ` Ian Kent
2006-09-07 6:17 ` Trond Myklebust
2006-09-07 7:40 ` Ian Kent
2006-09-05 9:48 ` David Howells
2006-09-05 10:14 ` Ian Kent
2006-09-05 9:57 ` David Howells
2006-09-05 12:47 ` Trond Myklebust
2006-09-05 12:53 ` Trond Myklebust
2006-09-05 13:40 ` David Howells
2006-09-06 10:27 ` Ian Kent
2006-09-04 13:46 ` David Howells
2006-09-04 15:00 ` Ian Kent
2006-09-05 4:11 ` Ian Kent
2006-09-05 4:17 ` Trond Myklebust
2006-09-05 2:23 ` Trond Myklebust
2006-09-05 3:01 ` Ian Kent [this message]
2006-09-05 4:05 ` Trond Myklebust
2006-09-05 4:06 ` Ian Kent
2006-09-05 4:57 ` Trond Myklebust
2006-09-05 6:45 ` Ian Kent
2006-09-05 7:07 ` Ian Kent
2006-09-04 18:20 ` David Howells
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=1157425309.3002.10.camel@raven.themaw.net \
--to=raven@themaw.net \
--cc=akpm@osdl.org \
--cc=dhowells@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
--cc=steved@redhat.com \
--cc=torvalds@osdl.org \
--cc=trond.myklebust@fys.uio.no \
/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).