9p: Fix possible regressions when ->get_sb fails.

->get_sb can fail causing some badness. this patch fixes
   * clear sb->fs_s_info in kill_sb.
   * deactivate_locked_super() calls kill_sb (v9fs_kill_super) which closes the
     destroys the client, clunks all its fids and closes the v9fs session.
     Attempting to do it twice will cause an oops.

Signed-off-by: Abhishek Kulkarni <adkulkar@umail.iu.edu>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
This commit is contained in:
Abhishek Kulkarni 2009-07-19 13:41:52 -06:00 committed by Eric Van Hensbergen
parent 4f4038328d
commit 1b5ab3e867
1 changed files with 7 additions and 4 deletions

View File

@ -120,7 +120,6 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
P9_DPRINTK(P9_DEBUG_VFS, " \n"); P9_DPRINTK(P9_DEBUG_VFS, " \n");
st = NULL;
v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
if (!v9ses) if (!v9ses)
return -ENOMEM; return -ENOMEM;
@ -173,10 +172,8 @@ P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
simple_set_mnt(mnt, sb); simple_set_mnt(mnt, sb);
return 0; return 0;
release_sb:
deactivate_locked_super(sb);
free_stat: free_stat:
p9stat_free(st);
kfree(st); kfree(st);
clunk_fid: clunk_fid:
@ -185,7 +182,12 @@ clunk_fid:
close_session: close_session:
v9fs_session_close(v9ses); v9fs_session_close(v9ses);
kfree(v9ses); kfree(v9ses);
return retval;
release_sb:
p9stat_free(st);
kfree(st);
deactivate_locked_super(sb);
return retval; return retval;
} }
@ -207,6 +209,7 @@ static void v9fs_kill_super(struct super_block *s)
v9fs_session_close(v9ses); v9fs_session_close(v9ses);
kfree(v9ses); kfree(v9ses);
s->s_fs_info = NULL;
P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n"); P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n");
} }