Skip to content

Commit

Permalink
nfs: initialize the backing_dev_info when creating the server
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed Sep 21, 2009
1 parent 87c6a9b commit 48d0764
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,6 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
goto out_error;

nfs_server_set_fsinfo(server, &fsinfo);
error = bdi_init(&server->backing_dev_info);
if (error)
goto out_error;


/* Get some general file system info */
if (server->namelen == 0) {
Expand Down Expand Up @@ -995,6 +991,12 @@ static struct nfs_server *nfs_alloc_server(void)
return NULL;
}

if (bdi_init(&server->backing_dev_info)) {
nfs_free_iostats(server->io_stats);
kfree(server);
return NULL;
}

return server;
}

Expand Down

0 comments on commit 48d0764

Please sign in to comment.