From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Frank van Maarseveen <frankvm@frankvm.com>,
Hua Zhong <hzhong@gmail.com>,
"'Linux Kernel Mailing List'" <linux-kernel@vger.kernel.org>,
akpm@linux-foundation.org
Subject: Re: recent nfs change causes autofs regression
Date: Fri, 31 Aug 2007 12:21:15 -0400 [thread overview]
Message-ID: <1188577275.6649.133.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0708302038310.25853@woody.linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
On Thu, 2007-08-30 at 20:49 -0700, Linus Torvalds wrote:
> Please send in a fix. If the fix involves making "nosharecache" the
> default, then that is better than making policy decisions like this in the
> kernel. The kernel should do what the user asks and not put in unnecessary
> roadblocks.
The best I can do given the constraints appears to be to have the kernel
first look for a superblock that matches both the fsid and the
user-specified mount options, and then spawn off a new superblock if
that search fails. The attached patch does just that.
Note that this is not the same as specifying nosharecache everywhere
since nosharecache will never attempt to match an existing superblock.
Finally, for the record: I still feel very uncomfortable about not being
able to report the state of the client setup back to the sysadmin.
AFAIK, the only way to do so is to stat the mountpoints, and compare the
device ids.
Trond
[-- Attachment #2: linux-2.6.23-009-nosharecache_is_default.dif --]
[-- Type: message/rfc822, Size: 8491 bytes --]
From: Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: No Subject
Date: Fri, 31 Aug 2007 10:45:17 -0400
Message-ID: <1188576086.6649.118.camel@heimdal.trondhjem.org>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/super.c | 110 +++++++++++++++++++++++++++++++++-----------------------
1 files changed, 64 insertions(+), 46 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c28f30d..8ed5937 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1303,34 +1303,6 @@ static void nfs_clone_super(struct super_block *sb,
nfs_initialise_sb(sb);
}
-static int nfs_set_super(struct super_block *s, void *_server)
-{
- struct nfs_server *server = _server;
- int ret;
-
- s->s_fs_info = server;
- ret = set_anon_super(s, server);
- if (ret == 0)
- server->s_dev = s->s_dev;
- return ret;
-}
-
-static int nfs_compare_super(struct super_block *sb, void *data)
-{
- struct nfs_server *server = data, *old = NFS_SB(sb);
-
- if (memcmp(&old->nfs_client->cl_addr,
- &server->nfs_client->cl_addr,
- sizeof(old->nfs_client->cl_addr)) != 0)
- return 0;
- /* Note: NFS_MOUNT_UNSHARED == NFS4_MOUNT_UNSHARED */
- if (old->flags & NFS_MOUNT_UNSHARED)
- return 0;
- if (memcmp(&old->fsid, &server->fsid, sizeof(old->fsid)) != 0)
- return 0;
- return 1;
-}
-
#define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS)
static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b, int flags)
@@ -1359,9 +1331,46 @@ static int nfs_compare_mount_options(const struct super_block *s, const struct n
goto Ebusy;
if (clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor)
goto Ebusy;
- return 0;
+ return 1;
Ebusy:
- return -EBUSY;
+ return 0;
+}
+
+struct nfs_sb_mountdata {
+ struct nfs_server *server;
+ int mntflags;
+};
+
+static int nfs_set_super(struct super_block *s, void *data)
+{
+ struct nfs_sb_mountdata *sb_mntdata = data;
+ struct nfs_server *server = sb_mntdata->server;
+ int ret;
+
+ s->s_flags = sb_mntdata->mntflags;
+ s->s_fs_info = server;
+ ret = set_anon_super(s, server);
+ if (ret == 0)
+ server->s_dev = s->s_dev;
+ return ret;
+}
+
+static int nfs_compare_super(struct super_block *sb, void *data)
+{
+ struct nfs_sb_mountdata *sb_mntdata = data;
+ struct nfs_server *server = sb_mntdata->server, *old = NFS_SB(sb);
+ int mntflags = sb_mntdata->mntflags;
+
+ if (memcmp(&old->nfs_client->cl_addr,
+ &server->nfs_client->cl_addr,
+ sizeof(old->nfs_client->cl_addr)) != 0)
+ return 0;
+ /* Note: NFS_MOUNT_UNSHARED == NFS4_MOUNT_UNSHARED */
+ if (old->flags & NFS_MOUNT_UNSHARED)
+ return 0;
+ if (memcmp(&old->fsid, &server->fsid, sizeof(old->fsid)) != 0)
+ return 0;
+ return nfs_compare_mount_options(sb, server, mntflags);
}
static int nfs_get_sb(struct file_system_type *fs_type,
@@ -1373,6 +1382,9 @@ static int nfs_get_sb(struct file_system_type *fs_type,
struct nfs_mount_data *data = raw_data;
struct dentry *mntroot;
int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
+ struct nfs_sb_mountdata sb_mntdata = {
+ .mntflags = flags,
+ };
int error;
/* Validate the mount data */
@@ -1386,28 +1398,25 @@ static int nfs_get_sb(struct file_system_type *fs_type,
error = PTR_ERR(server);
goto out;
}
+ sb_mntdata.server = server;
if (server->flags & NFS_MOUNT_UNSHARED)
compare_super = NULL;
/* Get a superblock - note that we may end up sharing one that already exists */
- s = sget(fs_type, compare_super, nfs_set_super, server);
+ s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata);
if (IS_ERR(s)) {
error = PTR_ERR(s);
goto out_err_nosb;
}
if (s->s_fs_info != server) {
- error = nfs_compare_mount_options(s, server, flags);
nfs_free_server(server);
server = NULL;
- if (error < 0)
- goto error_splat_super;
}
if (!s->s_root) {
/* initial superblock/root creation */
- s->s_flags = flags;
nfs_fill_super(s, data);
}
@@ -1460,6 +1469,9 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
struct nfs_server *server;
struct dentry *mntroot;
int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
+ struct nfs_sb_mountdata sb_mntdata = {
+ .mntflags = flags,
+ };
int error;
dprintk("--> nfs_xdev_get_sb()\n");
@@ -1470,28 +1482,25 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
error = PTR_ERR(server);
goto out_err_noserver;
}
+ sb_mntdata.server = server;
if (server->flags & NFS_MOUNT_UNSHARED)
compare_super = NULL;
/* Get a superblock - note that we may end up sharing one that already exists */
- s = sget(&nfs_fs_type, compare_super, nfs_set_super, server);
+ s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata);
if (IS_ERR(s)) {
error = PTR_ERR(s);
goto out_err_nosb;
}
if (s->s_fs_info != server) {
- error = nfs_compare_mount_options(s, server, flags);
nfs_free_server(server);
server = NULL;
- if (error < 0)
- goto error_splat_super;
}
if (!s->s_root) {
/* initial superblock/root creation */
- s->s_flags = flags;
nfs_clone_super(s, data->sb);
}
@@ -1729,6 +1738,9 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
struct dentry *mntroot;
char *mntpath = NULL, *hostname = NULL, *ip_addr = NULL;
int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
+ struct nfs_sb_mountdata sb_mntdata = {
+ .mntflags = flags,
+ };
int error;
/* Validate the mount data */
@@ -1744,12 +1756,13 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
error = PTR_ERR(server);
goto out;
}
+ sb_mntdata.server = server;
if (server->flags & NFS4_MOUNT_UNSHARED)
compare_super = NULL;
/* Get a superblock - note that we may end up sharing one that already exists */
- s = sget(fs_type, compare_super, nfs_set_super, server);
+ s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata);
if (IS_ERR(s)) {
error = PTR_ERR(s);
goto out_free;
@@ -1762,7 +1775,6 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
if (!s->s_root) {
/* initial superblock/root creation */
- s->s_flags = flags;
nfs4_fill_super(s);
}
@@ -1816,6 +1828,9 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
struct nfs_server *server;
struct dentry *mntroot;
int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
+ struct nfs_sb_mountdata sb_mntdata = {
+ .mntflags = flags,
+ };
int error;
dprintk("--> nfs4_xdev_get_sb()\n");
@@ -1826,12 +1841,13 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
error = PTR_ERR(server);
goto out_err_noserver;
}
+ sb_mntdata.server = server;
if (server->flags & NFS4_MOUNT_UNSHARED)
compare_super = NULL;
/* Get a superblock - note that we may end up sharing one that already exists */
- s = sget(&nfs_fs_type, compare_super, nfs_set_super, server);
+ s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata);
if (IS_ERR(s)) {
error = PTR_ERR(s);
goto out_err_nosb;
@@ -1844,7 +1860,6 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
if (!s->s_root) {
/* initial superblock/root creation */
- s->s_flags = flags;
nfs4_clone_super(s, data->sb);
}
@@ -1887,6 +1902,9 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
struct dentry *mntroot;
struct nfs_fh mntfh;
int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
+ struct nfs_sb_mountdata sb_mntdata = {
+ .mntflags = flags,
+ };
int error;
dprintk("--> nfs4_referral_get_sb()\n");
@@ -1897,12 +1915,13 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
error = PTR_ERR(server);
goto out_err_noserver;
}
+ sb_mntdata.server = server;
if (server->flags & NFS4_MOUNT_UNSHARED)
compare_super = NULL;
/* Get a superblock - note that we may end up sharing one that already exists */
- s = sget(&nfs_fs_type, compare_super, nfs_set_super, server);
+ s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata);
if (IS_ERR(s)) {
error = PTR_ERR(s);
goto out_err_nosb;
@@ -1915,7 +1934,6 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
if (!s->s_root) {
/* initial superblock/root creation */
- s->s_flags = flags;
nfs4_fill_super(s);
}
next prev parent reply other threads:[~2007-08-31 16:21 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-30 21:07 Hua Zhong
2007-08-30 22:37 ` Trond Myklebust
2007-08-30 22:47 ` Hua Zhong
2007-08-30 23:22 ` Trond Myklebust
2007-08-30 23:30 ` Hua Zhong
2007-08-30 23:37 ` Trond Myklebust
2007-08-30 23:44 ` Hua Zhong
2007-08-31 4:31 ` Trond Myklebust
2007-08-31 4:38 ` Linus Torvalds
2007-08-31 4:47 ` Hua Zhong
2007-08-31 4:57 ` Trond Myklebust
2007-08-31 5:09 ` Ian Kent
2007-08-31 7:50 ` Matthias Schniedermeyer
2007-08-31 1:24 ` Andrew Morton
2007-08-31 4:33 ` Trond Myklebust
2007-08-31 3:49 ` Linus Torvalds
2007-08-31 3:57 ` Hua Zhong
2007-08-31 4:44 ` Trond Myklebust
2007-08-31 4:59 ` Linus Torvalds
2007-08-31 5:04 ` Trond Myklebust
2007-08-31 5:16 ` Linus Torvalds
2007-08-31 7:40 ` Jakob Oestergaard
2007-08-31 8:07 ` Linus Torvalds
2007-08-31 8:51 ` Jakob Oestergaard
2007-08-31 16:43 ` Linus Torvalds
2007-09-03 13:20 ` Jakob Oestergaard
2007-09-03 13:43 ` Martin Knoblauch
2007-08-31 12:11 ` Trond Myklebust
2007-08-31 13:12 ` Frank van Maarseveen
2007-08-31 13:50 ` Trond Myklebust
2007-08-31 14:42 ` Frank van Maarseveen
2007-09-04 7:51 ` David Howells
2007-08-31 8:28 ` Frank van Maarseveen
2007-08-31 5:24 ` Hua Zhong
2007-08-31 5:38 ` Ian Kent
2007-08-31 8:54 ` Martin Knoblauch
2007-08-31 16:21 ` Trond Myklebust [this message]
2007-08-31 17:01 ` Linus Torvalds
2007-08-31 19:03 ` Trond Myklebust
2007-08-31 18:47 ` Hua Zhong
2007-08-31 19:13 ` Trond Myklebust
2007-08-31 19:35 ` Hua Zhong
2007-08-31 19:41 ` Hua Zhong
2007-09-02 0:58 ` Bill Davidsen
2007-09-04 7:54 ` David Howells
2007-09-05 12:35 ` Bill Davidsen
2007-09-05 12:44 ` Ian Kent
2007-09-05 16:26 ` Trond Myklebust
2007-09-05 15:34 ` David Howells
2007-09-05 15:37 ` David Howells
2007-09-05 15:50 ` Trond Myklebust
2007-09-06 5:23 ` Ian Kent
2007-09-04 8:02 ` David Howells
2007-09-04 8:35 ` David Howells
2007-09-04 9:04 ` Linus Torvalds
2007-08-31 8:14 ` Frank van Maarseveen
2007-08-31 9:05 ` Ian Kent
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=1188577275.6649.133.camel@heimdal.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=akpm@linux-foundation.org \
--cc=frankvm@frankvm.com \
--cc=hzhong@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®