From: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org
Subject: Re: [PATCH] CIFS: Fix kernel crash on simultaneous mount/umount calls
Date: Sat, 11 Jun 2011 05:43:14 -0400 [thread overview]
Message-ID: <20110611094314.GA6217@infradead.org> (raw)
In-Reply-To: <BANLkTikmfKtDxG_6qg+6JiCT2FzF1FFfQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
> one of these two processes process umount call. So, it comes to
> cifs_put_super, calls cifs_umount and then calls kfree(cifs_sb). In
> the same time, another process comes into cifs_do_mount and calls
> sget(). Then it appers into cifs_match_super that thinks that all
> structures like server, ses, tcon and cifs_sb are valid, but it is not
> true - the first process has already freed them but didn't remove
> superblock from fs_supers list.
>
> So, I simply reodered calls: now umount codepath marks a superblock as
> non-active and calls kill_sb(new cifs_kill_super), it calls
> kill_anon_super (that calls cifs_put_super and removes superblock from
> fs_supers list) and after that kill_sb frees all cifs structures
> (server, ses, tcon, cifs_sb).
>
> As the result, when we get into cifs_match_super (in mount from
> another process) we are sure that all cifs structures are valid.
>
> If I am not right, correct me, please!
Ok, if we look at sb-private data in the sget callsbacks it seems like
the clreanup for those does indeed need to be done in ->kill_sb. I have
to say I really hate it, and the culprit is that we call the sget test
callback is called before we call grab_super in sget, that is we don't
protect against filesystems going away. I suspect that is the real
problem here.
The workaround you've copied from NFS also works, but it's pretty
ugly, given that ->kill_sb also is called for partially set up
superblocks.
next prev parent reply other threads:[~2011-06-11 9:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-09 12:29 [PATCH] CIFS: Fix kernel crash on simultaneous mount/umount calls Pavel Shilovsky
[not found] ` <1307622570-7141-1-git-send-email-piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-06-09 12:40 ` Christoph Hellwig
[not found] ` <20110609124043.GA9621-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2011-06-09 16:30 ` Pavel Shilovsky
[not found] ` <BANLkTikmfKtDxG_6qg+6JiCT2FzF1FFfQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-10 6:00 ` Pavel Shilovsky
2011-06-11 9:43 ` Christoph Hellwig [this message]
[not found] ` <20110611094314.GA6217-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2011-06-11 11:12 ` Al Viro
[not found] ` <20110611111253.GD11521-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-06-11 14:00 ` Pavel Shilovsky
[not found] ` <BANLkTim==J7=-bEz1pahhKuxFdMFe2BnWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-17 3:54 ` Al Viro
[not found] ` <20110617035421.GO11521-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-06-17 14:08 ` Al Viro
[not found] ` <20110617140833.GA9563-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-06-20 12:54 ` Pavel Shilovsky
[not found] ` <BANLkTi=mH-9F9N4Gz8JJqL==Hm5p8Y1_tQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-20 12:59 ` Jeff Layton
[not found] ` <20110620085943.6371af1b-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-06-20 16:13 ` Steve French
[not found] ` <BANLkTinfETnDdcBFkQNq8pLZPQOGsVRuGA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-20 16:15 ` Al Viro
[not found] ` <20110620161516.GU11521-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-06-24 8:47 ` Pavel Shilovsky
[not found] ` <BANLkTi=nYfiy0qnHPXs2fckCPNJXwbpi7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-24 10:48 ` Jeff Layton
[not found] ` <20110624064810.495dec99-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-06-24 22:54 ` [git pull] ->mount() regression fixes for cifs Al Viro
[not found] ` <20110624225414.GA11013-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-06-24 23:03 ` Steve French
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=20110611094314.GA6217@infradead.org \
--to=hch-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
--cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.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