Re: mnt_count accounting broken

From: Tigran Aivazian (tigran@veritas.com)
Date: Fri May 05 2000 - 11:43:14 EST


Hi,

Ok, here is the promised "consistent reproducible picture" and, btw,
the "-o noatime" observation seemed to be bogus (i.e. some small changes
I made distorted the picture). Below is a session with a clean
2.3.99-pre7-5 (with a tiny debug patch below):

# mount -t ramfs none /mnt/m3
# cd /mnt/m3
# touch new
# l
total 0
-rw-r--r-- 1 root root 0 May 5 17:33 new
# cd
# umount /mnt/m3
C: count!=2 (3)
umount: /mnt/m3: device is busy

# mount -t ramfs -o noatime none /mnt/m4
# cd /mnt/m4
# touch new
# l
total 0
-rw-r--r-- 1 root root 0 May 5 17:34 new
# cd
# umount /mnt/m4
C: count!=2 (3)
umount: /mnt/m4: device is busy

# mount -t ramfs none /mnt/m5
# touch /mnt/m5/new
# umount /mnt/m5
C: count!=2 (3)
umount: /mnt/m5: device is busy
# rm /mnt/m5/new
# umount /mnt/m5
A: mnt_count>2 (3)
umount: /mnt/m5: device is busy
# l /mnt/m5
total 0
# umount /mnt/m5
A: mnt_count>2 (3)
umount: /mnt/m5: device is busy

--- linux/fs/super.c Fri May 5 08:20:28 2000
+++ work/fs/super.c Fri May 5 17:22:30 2000
@@ -921,6 +921,8 @@
         }
 
         if (atomic_read(&mnt->mnt_count) > 2) {
+ printk(KERN_ERR "A: mnt_count>2 (%d)\n",
+ atomic_read(&mnt->mnt_count));
                 mntput(mnt);
                 return -EBUSY;
         }
@@ -965,6 +967,8 @@
         /* Something might grab it again - redo checks */
 
         if (atomic_read(&mnt->mnt_count) > 2) {
+ printk(KERN_ERR "B: mnt_count>2 (%d)\n",
+ atomic_read(&mnt->mnt_count));
                 mntput(mnt);
                 return -EBUSY;
         }
@@ -980,11 +984,16 @@
         count = d_active_refs(sb->s_root);
         if (mnt->mnt_parent == mnt)
                 count--;
- if (count != 2)
+ if (count != 2) {
+ printk(KERN_ERR "C: count!=2 (%d)\n", count);
                 return -EBUSY;
+ }
 
- if (sb->s_root->d_inode->i_state)
+ if (sb->s_root->d_inode->i_state) {
+ printk(KERN_ERR "D: i_state=%d\n",
+ sb->s_root->d_inode->i_state);
                 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:17 EST