[patch] Re: found it! Re: mnt_count accounting broken

From: Tigran Aivazian (tigran@veritas.com)
Date: Fri May 05 2000 - 15:38:07 EST


ok, how about this patch?

On Fri, 5 May 2000, Tigran Aivazian wrote:

> found it!
>
> if (count != 2) {
> return -EBUSY;
>
>
> should be
>
> if (count != 2) {
> mntput(mnt);
> return -EBUSY;
>
>
> and the same for the check if (i_state) below as well. Right? I didn't
> test it yet but I feel it is right...
>
> Regards,
> Tigran
>
> On Fri, 5 May 2000, Tigran Aivazian wrote:
>
> > On Fri, 5 May 2000, Tigran Aivazian wrote:
> >
> > > On Fri, 5 May 2000, Alexander Viro wrote:
> > >
> > > >
> > > > Tigran, could you check at which point does ->mnt_count go up?
> > > > Because it does - you are starting with 2 and ending up with 3.
> > > > Try to add printk() into the get_filesystem_info().
> > > >
> > > >
> > > ok, will try now.
> >
> > it goes up when the first attempt to umount (on non-empty
> > filesystem) fails. So, after that it will fail even after I unlink the new
> > file.
> >
> > Now, if within 5 minutes I don't figure out what causes it (just need to
> > check failing umount codepath?), then ok - please go ahead and tell us the
> > solution :)
> >
> > Regards,
> > Tigran
> >

--- linux/fs/super.c Fri May 5 08:20:28 2000
+++ work/fs/super.c Fri May 5 21:35:29 2000
@@ -980,11 +980,15 @@
         count = d_active_refs(sb->s_root);
         if (mnt->mnt_parent == mnt)
                 count--;
- if (count != 2)
+ if (count != 2) {
+ mntput(mnt);
                 return -EBUSY;
+ }
 
- if (sb->s_root->d_inode->i_state)
+ if (sb->s_root->d_inode->i_state) {
+ mntput(mnt);
                 return -EBUSY;
+ }
 
         /* OK, that's the point of no return */
         mntput(mnt);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:18 EST