diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-09-21 03:59:39 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-09-21 09:40:33 -0400 |
commit | 48d0764998ad4ab7570afab8bb3bee0fbfa55b2a (patch) | |
tree | 7ad93edfbba609f7f7a730d66d47950630e203d3 /fs | |
parent | 87c6a9b253520b66e7f5e8f67a37a701eaa51cee (diff) |
nfs: initialize the backing_dev_info when creating the server
NFS may free the server structure without ever having used the
bdi, so we either need to flag the bdi as being uninitialized or
initialize it up front. This does the latter.
This fixes a crash with mounting more than one NFS file system,
should people ever need that kind of obscure NFS functionality.
Tested-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/client.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index e350bd6a2334..a7ce15d3c248 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -933,10 +933,6 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str | |||
933 | goto out_error; | 933 | goto out_error; |
934 | 934 | ||
935 | nfs_server_set_fsinfo(server, &fsinfo); | 935 | nfs_server_set_fsinfo(server, &fsinfo); |
936 | error = bdi_init(&server->backing_dev_info); | ||
937 | if (error) | ||
938 | goto out_error; | ||
939 | |||
940 | 936 | ||
941 | /* Get some general file system info */ | 937 | /* Get some general file system info */ |
942 | if (server->namelen == 0) { | 938 | if (server->namelen == 0) { |
@@ -995,6 +991,12 @@ static struct nfs_server *nfs_alloc_server(void) | |||
995 | return NULL; | 991 | return NULL; |
996 | } | 992 | } |
997 | 993 | ||
994 | if (bdi_init(&server->backing_dev_info)) { | ||
995 | nfs_free_iostats(server->io_stats); | ||
996 | kfree(server); | ||
997 | return NULL; | ||
998 | } | ||
999 | |||
998 | return server; | 1000 | return server; |
999 | } | 1001 | } |
1000 | 1002 | ||