* mkdir on read-only NFS is broken in 2.6.18
@ 2006-10-23 9:23 Thomas Zeitlhofer
2006-10-23 10:33 ` Trond Myklebust
2006-10-24 14:01 ` automount nfs: mkdir_path /net/host/dir failed: Read-only file system Frank van Maarseveen
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Zeitlhofer @ 2006-10-23 9:23 UTC (permalink / raw)
To: linux-kernel
Hello,
there is a problem in 2.6.18/.1 when mkdir is called for an existing
directory on a read-only mounted NFS filesystem.
Lets consider a server that exports the directory /export which contains
the directory-tree a/b/c:
1) If /export is mounted ro and the first access to a, b, or c is
mkdir, then this directory and all directories underneath become
inaccessible:
client:# mount server:/export /mnt -o ro
client:# mkdir /mnt/a/b
mkdir: cannot create directory `/mnt/a/b': Read-only file system
client:# find /mnt
/mnt
/mnt/a
find: /mnt/a/b: No such file or directory
2) If /export is mounted ro and the first access to a, b, or c is _not_
by calling mkdir, then a following mkdir does not destroy the directory
structure (and mkdir now returns EEXIST):
client:# mount server:/export /mnt -o ro
client:# find /mnt
/mnt
/mnt/a
/mnt/a/b
/mnt/a/b/c
client:# mkdir /mnt/a/b
mkdir: cannot create directory `/mnt/a/b': File exists
client:# find /mnt
/mnt
/mnt/a
/mnt/a/b
/mnt/a/b/c
3) If /export is mounted rw (although exported ro), then mkdir does not
destroy the directory structure:
client:# mount server:/export /mnt -o rw
client:# mkdir /mnt/a/b
mkdir: cannot create directory `/mnt/a/b': Read-only file system
client:# find /mnt
/mnt
/mnt/a
/mnt/a/b
/mnt/a/b/c
As a consequence of 1), autofs does not work with mountpoints on NFS
(ro) because the automount daemon calls mkdir for all directories in the
path to the mountpoint. This seems related to the discussion [1], and,
as suggested in [1], the issue is fixed by reverting the patch:
http://kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a634904a7de0d3a0bc606f608007a34e8c05bfee;hp=ddeff520f02b92128132c282c350fa72afffb84a
So please consider this patch for the next -stable release:
diff --git a/fs/namei.c b/fs/namei.c
index 432d6bc..5201d77 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1774,8 +1774,6 @@ struct dentry *lookup_create(struct name
if (nd->last_type != LAST_NORM)
goto fail;
nd->flags &= ~LOOKUP_PARENT;
- nd->flags |= LOOKUP_CREATE;
- nd->intent.open.flags = O_EXCL;
/*
* Do the final lookup.
--
[1] http://lkml.org/lkml/2006/9/22/182
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: mkdir on read-only NFS is broken in 2.6.18
2006-10-23 9:23 mkdir on read-only NFS is broken in 2.6.18 Thomas Zeitlhofer
@ 2006-10-23 10:33 ` Trond Myklebust
2006-10-23 13:14 ` Thomas Zeitlhofer
2006-10-24 14:01 ` automount nfs: mkdir_path /net/host/dir failed: Read-only file system Frank van Maarseveen
1 sibling, 1 reply; 4+ messages in thread
From: Trond Myklebust @ 2006-10-23 10:33 UTC (permalink / raw)
To: Thomas Zeitlhofer; +Cc: linux-kernel
On Mon, 2006-10-23 at 11:23 +0200, Thomas Zeitlhofer wrote:
> Hello,
>
> there is a problem in 2.6.18/.1 when mkdir is called for an existing
> directory on a read-only mounted NFS filesystem.
>
> Lets consider a server that exports the directory /export which contains
> the directory-tree a/b/c:
>
> 1) If /export is mounted ro and the first access to a, b, or c is
> mkdir, then this directory and all directories underneath become
> inaccessible:
>
> client:# mount server:/export /mnt -o ro
> client:# mkdir /mnt/a/b
> mkdir: cannot create directory `/mnt/a/b': Read-only file system
> client:# find /mnt
> /mnt
> /mnt/a
> find: /mnt/a/b: No such file or directory
>
> 2) If /export is mounted ro and the first access to a, b, or c is _not_
> by calling mkdir, then a following mkdir does not destroy the directory
> structure (and mkdir now returns EEXIST):
>
> client:# mount server:/export /mnt -o ro
> client:# find /mnt
> /mnt
> /mnt/a
> /mnt/a/b
> /mnt/a/b/c
> client:# mkdir /mnt/a/b
> mkdir: cannot create directory `/mnt/a/b': File exists
> client:# find /mnt
> /mnt
> /mnt/a
> /mnt/a/b
> /mnt/a/b/c
>
> 3) If /export is mounted rw (although exported ro), then mkdir does not
> destroy the directory structure:
>
> client:# mount server:/export /mnt -o rw
> client:# mkdir /mnt/a/b
> mkdir: cannot create directory `/mnt/a/b': Read-only file system
> client:# find /mnt
> /mnt
> /mnt/a
> /mnt/a/b
> /mnt/a/b/c
>
> As a consequence of 1), autofs does not work with mountpoints on NFS
> (ro) because the automount daemon calls mkdir for all directories in the
> path to the mountpoint. This seems related to the discussion [1], and,
> as suggested in [1], the issue is fixed by reverting the patch:
There should already be a fix for this issue in 2.6.19-rc1. See
http://kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fd6840714d9cf6e93f1d42b904860a94df316b85
Note, though, that the autofs behaviour that you describe above is
seriously broken (mkdir as root on an NFS partition is _not_
acceptable).
Cheers,
Trond
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mkdir on read-only NFS is broken in 2.6.18
2006-10-23 10:33 ` Trond Myklebust
@ 2006-10-23 13:14 ` Thomas Zeitlhofer
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Zeitlhofer @ 2006-10-23 13:14 UTC (permalink / raw)
To: Trond Myklebust; +Cc: linux-kernel
On Mon, Oct 23, 2006 at 06:33:42AM -0400, Trond Myklebust wrote:
> On Mon, 2006-10-23 at 11:23 +0200, Thomas Zeitlhofer wrote:
> > Hello,
> >
> > there is a problem in 2.6.18/.1 when mkdir is called for an existing
> > directory on a read-only mounted NFS filesystem.
> >
> > Lets consider a server that exports the directory /export which contains
> > the directory-tree a/b/c:
> >
> > 1) If /export is mounted ro and the first access to a, b, or c is
> > mkdir, then this directory and all directories underneath become
> > inaccessible:
> >
> > client:# mount server:/export /mnt -o ro
> > client:# mkdir /mnt/a/b
> > mkdir: cannot create directory `/mnt/a/b': Read-only file system
> > client:# find /mnt
> > /mnt
> > /mnt/a
> > find: /mnt/a/b: No such file or directory
[...]
> > As a consequence of 1), autofs does not work with mountpoints on NFS
> > (ro) because the automount daemon calls mkdir for all directories in the
> > path to the mountpoint. This seems related to the discussion [1], and,
> > as suggested in [1], the issue is fixed by reverting the patch:
>
> There should already be a fix for this issue in 2.6.19-rc1. See
>
> http://kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fd6840714d9cf6e93f1d42b904860a94df316b85
Yes, this patch fixes the issue for 2.6.18 too.
Just a note, there still seems to be some inconsistency regarding the
errno returned by mkdir:
client:# mount server:/export /mnt -o ro
client:# mkdir /mnt/a/b
mkdir: cannot create directory `/mnt/a/b': Read-only file system
client:# find /mnt
/mnt
/mnt/a
/mnt/a/b
/mnt/a/b/c
client:# mkdir /mnt/a/b
mkdir: cannot create directory `/mnt/a/b': File exists
Depending on the context, mkdir returns EROFS or EEXIST - shouldn't we
get always the same errno? Using the patch from my previous mail (or a
2.6.17 kernel), mkdir will always return EEXIST in this case.
Thanks,
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* automount nfs: mkdir_path /net/host/dir failed: Read-only file system
2006-10-23 9:23 mkdir on read-only NFS is broken in 2.6.18 Thomas Zeitlhofer
2006-10-23 10:33 ` Trond Myklebust
@ 2006-10-24 14:01 ` Frank van Maarseveen
1 sibling, 0 replies; 4+ messages in thread
From: Frank van Maarseveen @ 2006-10-24 14:01 UTC (permalink / raw)
To: Thomas Zeitlhofer; +Cc: linux-kernel
On Mon, Oct 23, 2006 at 11:23:29AM +0200, Thomas Zeitlhofer wrote:
>
> there is a problem in 2.6.18/.1 when mkdir is called for an existing
> directory on a read-only mounted NFS filesystem.
[...]
> As a consequence of 1), autofs does not work with mountpoints on NFS
I'm hitting this regression too
> So please consider this patch for the next -stable release:
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 432d6bc..5201d77 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1774,8 +1774,6 @@ struct dentry *lookup_create(struct name
> if (nd->last_type != LAST_NORM)
> goto fail;
> nd->flags &= ~LOOKUP_PARENT;
> - nd->flags |= LOOKUP_CREATE;
> - nd->intent.open.flags = O_EXCL;
>
> /*
> * Do the final lookup.
yep, fixes it for me. Thankx.
--
Frank
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-10-24 14:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-23 9:23 mkdir on read-only NFS is broken in 2.6.18 Thomas Zeitlhofer
2006-10-23 10:33 ` Trond Myklebust
2006-10-23 13:14 ` Thomas Zeitlhofer
2006-10-24 14:01 ` automount nfs: mkdir_path /net/host/dir failed: Read-only file system Frank van Maarseveen
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).